根據OpenID Connect specification是sub
openid
範圍的索賠部分或profile
範圍?我無法找到該信息'sub'聲明openid作用域或配置文件作用域的一部分嗎?
更新1
我正在使用IdentityServer3進行身份驗證。客戶端正在向服務器發送請求,如下所示。作爲迴應,我沒有得到sub
索賠,這是根據Open ID Connect規範要求的。然而,答覆確實包括http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier
,其值與sub
的值相同。nameidentifier
與sub
索賠相同。
下面是客戶端的請求
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Authority = "https://localhost:44314/identity",
Scope = "openid",
ClientId = "LocalHostMvcClient",
RedirectUri = "http://localhost:34937/",
ResponseType = "id_token",
SignInAsAuthenticationType = "Cookies",
}
}
id_token響應
更新2
基礎上,下面的評論我已經更新了客戶端的啓動文件
private void TurnOffMicrosoftJWTMapping()
{
//The long claim names come from Microsoft’s JWT handler trying to map some claim types to .NET’s ClaimTypes class types.
//We can turn off this behavior with the following line of code (in Startup).
//This also means that we need to adjust the configuration for anti-CSRF protection to the new unique sub claim type:
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.Subject;
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
}
,然後在客戶端的啓動
public class Startup
{
public void Configuration(IAppBuilder app)
{
TurnOffMicrosoftJWTMapping();
//configure OpenIDConnect request here
}
}
謝謝,我已經更新了我的答案 – LP13
'sub'字符串 - 頒發者最終用戶的標識符。 - 這可以有任何價值? –