Asp.net core 如何使用typ:jwt而不是at+;身份服务器4中的jwt?
与Identity Server 3相反,Identity Server 4发行具有默认值的令牌Asp.net core 如何使用typ:jwt而不是at+;身份服务器4中的jwt?,asp.net-core,identityserver4,Asp.net Core,Identityserver4,与Identity Server 3相反,Identity Server 4发行具有默认值的令牌“typ”:“at+jwt”,但是我仍然需要发行旧版本的令牌,意思是“typ”:“jwt” 是否有任何方法覆盖IS4的默认配置并发出JWT令牌(类型):“JWT”?我想您只需将此IdentityServer选项设置为JWT: /// <summary> /// Gets or sets the value for the JWT typ header for access
“typ”:“at+jwt”
,但是我仍然需要发行旧版本的令牌,意思是“typ”:“jwt”
是否有任何方法覆盖IS4的默认配置并发出JWT令牌(类型):“JWT”?我想您只需将此IdentityServer选项设置为JWT:
/// <summary>
/// Gets or sets the value for the JWT typ header for access tokens.
/// </summary>
/// <value>
/// The JWT typ value.
/// </value>
public string AccessTokenJwtType { get; set; } = "at+jwt";
//
///获取或设置访问令牌的JWT typ头的值。
///
///
///JWT类型值。
///
公共字符串AccessTokenJwtType{get;set;}=“at+jwt”;
请参阅源代码:我想您只需将此IdentityServer选项设置为jwt:
/// <summary>
/// Gets or sets the value for the JWT typ header for access tokens.
/// </summary>
/// <value>
/// The JWT typ value.
/// </value>
public string AccessTokenJwtType { get; set; } = "at+jwt";
//
///获取或设置访问令牌的JWT typ头的值。
///
///
///JWT类型值。
///
公共字符串AccessTokenJwtType{get;set;}=“at+jwt”;
查看源代码:只需更改
AddIdentityServer上的AccessTokenJwtType
:
var builder = services.AddIdentityServer(options =>
{
// see https://identityserver4.readthedocs.io/en/latest/topics/resources.html
options.EmitStaticAudienceClaim = true;
options.AccessTokenJwtType = "JWT";
})
在这里,我也解释了它只需更改AddIdentityServer上的AccessTokenJwtType
:
var builder = services.AddIdentityServer(options =>
{
// see https://identityserver4.readthedocs.io/en/latest/topics/resources.html
options.EmitStaticAudienceClaim = true;
options.AccessTokenJwtType = "JWT";
})
我在这里也解释了这一点这是否总是必要的?我读了你们的帖子,我明白了:若它不起作用,那个么广告就会自动播放。但我不知道这什么时候是有效的。它并不总是必需的,当我们使用IDS4+.NETFramework MVC应用程序或API(无.NETCore或.NET5)时,它是必需的。这将以issuer\u name/resources
格式发出aud
索赔@YodaIs此EmitStaticAudienceClaim
始终是必需的吗?我读了你们的帖子,我明白了:若它不起作用,那个么广告就会自动播放。但我不知道这什么时候是有效的。它并不总是必需的,当我们使用IDS4+.NETFramework MVC应用程序或API(无.NETCore或.NET5)时,它是必需的。这将以issuer\u name/resources
格式发出aud
索赔@尤达