'sub' claim 是 openid 范围或配置文件范围的一部分吗?
Is 'sub' claim part of openid scope or profile scope?
根据 OpenID Connect specification 是 sub
声明部分 openid
范围还是 profile
范围?我找不到该信息
更新1
我正在使用 IdentityServer3 进行身份验证。客户端正在向服务器发出请求,如下所示。作为回应,我没有收到 Open ID Connect 规范要求的 sub
声明。但是,响应确实包括 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
}
}
都不是,它只是一个 required claim of the ID Token,无论何时发布。
sub 是 id_token 的必需声明 - openid 范围是发出 OpenID Connect 身份验证请求所需的最小范围。您可以将 openid 与其他范围混合使用 - 但 openid 必须存在。
这就是他们的关系。
IdentityServer 根据以下条件发出标准声明类型(例如 sub):
https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
是 Microsoft JWT 处理程序将这些标准声明转换为 Microsoft 专有声明。您可以通过以下方式关闭这种烦人的行为:
JwtSecurityTokenHandler.InboundClaimTypeMap.Clear()
根据 OpenID Connect specification 是 sub
声明部分 openid
范围还是 profile
范围?我找不到该信息
更新1
我正在使用 IdentityServer3 进行身份验证。客户端正在向服务器发出请求,如下所示。作为回应,我没有收到 Open ID Connect 规范要求的 sub
声明。但是,响应确实包括 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
}
}
都不是,它只是一个 required claim of the ID Token,无论何时发布。
sub 是 id_token 的必需声明 - openid 范围是发出 OpenID Connect 身份验证请求所需的最小范围。您可以将 openid 与其他范围混合使用 - 但 openid 必须存在。
这就是他们的关系。
IdentityServer 根据以下条件发出标准声明类型(例如 sub):
https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
是 Microsoft JWT 处理程序将这些标准声明转换为 Microsoft 专有声明。您可以通过以下方式关闭这种烦人的行为:
JwtSecurityTokenHandler.InboundClaimTypeMap.Clear()