JwtSecurityTokenHandler.CreateJwtSecurityToken Método

Definição

Sobrecargas

CreateJwtSecurityToken(String, String, ClaimsIdentity, Nullable<DateTime>, Nullable<DateTime>, Nullable<DateTime>, SigningCredentials, EncryptingCredentials, IDictionary<String,Object>)

public virtual System.IdentityModel.Tokens.Jwt.JwtSecurityToken CreateJwtSecurityToken(string issuer, string audience, System.Security.Claims.ClaimsIdentity subject, DateTime? notBefore, DateTime? expires, DateTime? issuedAt, Microsoft.IdentityModel.Tokens.SigningCredentials signingCredentials, Microsoft.IdentityModel.Tokens.EncryptingCredentials encryptingCredentials, System.Collections.Generic.IDictionary<string,object> claimCollection);
abstract member CreateJwtSecurityToken : string * string * System.Security.Claims.ClaimsIdentity * Nullable<DateTime> * Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SigningCredentials * Microsoft.IdentityModel.Tokens.EncryptingCredentials * System.Collections.Generic.IDictionary<string, obj> -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
override this.CreateJwtSecurityToken : string * string * System.Security.Claims.ClaimsIdentity * Nullable<DateTime> * Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SigningCredentials * Microsoft.IdentityModel.Tokens.EncryptingCredentials * System.Collections.Generic.IDictionary<string, obj> -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
Public Overridable Function CreateJwtSecurityToken (issuer As String, audience As String, subject As ClaimsIdentity, notBefore As Nullable(Of DateTime), expires As Nullable(Of DateTime), issuedAt As Nullable(Of DateTime), signingCredentials As SigningCredentials, encryptingCredentials As EncryptingCredentials, claimCollection As IDictionary(Of String, Object)) As JwtSecurityToken

Parâmetros

issuer
String

O emissor do token.

audience
String

O público-alvo desse token.

subject
ClaimsIdentity

A origem Claimdo (s) para esse token.

notBefore
Nullable<DateTime>

A hora anterior para esse token.

expires
Nullable<DateTime>

A hora de expiração desse token.

issuedAt
Nullable<DateTime>

O tempo de problema para esse token.

signingCredentials
SigningCredentials

Contém material criptográfico para gerar uma assinatura.

encryptingCredentials
EncryptingCredentials

Contém material criptográfico para criptografar o token.

claimCollection
IDictionary<String,Object>

Uma coleção de pares (chave,valor) que Claimrepresentam (s) para esse token.

Retornos

Um JwtSecurityToken.

Exceções

If expires<= notBefore.

Comentários

Se Actor não for nulo, uma declaração { actort, 'value' } será adicionada ao conteúdo. CreateActorValue(ClaimsIdentity) para obter detalhes sobre como o valor é criado.

Consulte <seealso cref="T:System.IdentityModel.Tokens.Jwt.JwtHeader"></seealso> para obter detalhes sobre como os HeaderParameters são adicionados ao cabeçalho.

Consulte <seealso cref="T:System.IdentityModel.Tokens.Jwt.JwtPayload"></seealso> para obter detalhes sobre como os valores são adicionados ao conteúdo.

Cada Claim um nos subject adicionados terá Type traduzido de acordo com o mapeamento encontrado em OutboundClaimTypeMap. Adicionar e remover afetará OutboundClaimTypeMap o componente de nome da declaração Json.

SigningCredentials(SecurityKey, String) é usado para assinar RawData.

EncryptingCredentials(SecurityKey, String, String) é usado para criptografar RawData ou RawPayload .

Aplica-se a

CreateJwtSecurityToken(String, String, ClaimsIdentity, Nullable<DateTime>, Nullable<DateTime>, Nullable<DateTime>, SigningCredentials, EncryptingCredentials)

public virtual System.IdentityModel.Tokens.Jwt.JwtSecurityToken CreateJwtSecurityToken(string issuer, string audience, System.Security.Claims.ClaimsIdentity subject, DateTime? notBefore, DateTime? expires, DateTime? issuedAt, Microsoft.IdentityModel.Tokens.SigningCredentials signingCredentials, Microsoft.IdentityModel.Tokens.EncryptingCredentials encryptingCredentials);
abstract member CreateJwtSecurityToken : string * string * System.Security.Claims.ClaimsIdentity * Nullable<DateTime> * Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SigningCredentials * Microsoft.IdentityModel.Tokens.EncryptingCredentials -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
override this.CreateJwtSecurityToken : string * string * System.Security.Claims.ClaimsIdentity * Nullable<DateTime> * Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SigningCredentials * Microsoft.IdentityModel.Tokens.EncryptingCredentials -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
Public Overridable Function CreateJwtSecurityToken (issuer As String, audience As String, subject As ClaimsIdentity, notBefore As Nullable(Of DateTime), expires As Nullable(Of DateTime), issuedAt As Nullable(Of DateTime), signingCredentials As SigningCredentials, encryptingCredentials As EncryptingCredentials) As JwtSecurityToken

Parâmetros

issuer
String

O emissor do token.

audience
String

O público-alvo desse token.

subject
ClaimsIdentity

A origem Claimdo (s) para esse token.

notBefore
Nullable<DateTime>

A hora anterior para esse token.

expires
Nullable<DateTime>

A hora de expiração desse token.

issuedAt
Nullable<DateTime>

O tempo de problema para esse token.

signingCredentials
SigningCredentials

Contém material criptográfico para gerar uma assinatura.

encryptingCredentials
EncryptingCredentials

Contém material criptográfico para criptografar o token.

Retornos

Um JwtSecurityToken.

Exceções

If expires<= notBefore.

Comentários

Se Actor não for nulo, uma declaração { actort, 'value' } será adicionada ao conteúdo. CreateActorValue(ClaimsIdentity) para obter detalhes sobre como o valor é criado.

Consulte <seealso cref="T:System.IdentityModel.Tokens.Jwt.JwtHeader"></seealso> para obter detalhes sobre como os HeaderParameters são adicionados ao cabeçalho.

Consulte <seealso cref="T:System.IdentityModel.Tokens.Jwt.JwtPayload"></seealso> para obter detalhes sobre como os valores são adicionados ao conteúdo.

Cada Claim um nos subject adicionados terá Type traduzido de acordo com o mapeamento encontrado em OutboundClaimTypeMap. Adicionar e remover afetará OutboundClaimTypeMap o componente de nome da declaração Json.

SigningCredentials(SecurityKey, String) é usado para assinar RawData.

EncryptingCredentials(SecurityKey, String, String) é usado para criptografar RawData ou RawPayload .

Aplica-se a

CreateJwtSecurityToken(SecurityTokenDescriptor)

Cria um JWT (Token Web Json).

public virtual System.IdentityModel.Tokens.Jwt.JwtSecurityToken CreateJwtSecurityToken(Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor tokenDescriptor);
abstract member CreateJwtSecurityToken : Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
override this.CreateJwtSecurityToken : Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
Public Overridable Function CreateJwtSecurityToken (tokenDescriptor As SecurityTokenDescriptor) As JwtSecurityToken

Parâmetros

tokenDescriptor
SecurityTokenDescriptor

Um SecurityTokenDescriptor que contém detalhes do conteúdo do token.

Retornos

Comentários

SigningCredentials é usado para assinar RawData.

Aplica-se a

CreateJwtSecurityToken(String, String, ClaimsIdentity, Nullable<DateTime>, Nullable<DateTime>, Nullable<DateTime>, SigningCredentials)

public virtual System.IdentityModel.Tokens.Jwt.JwtSecurityToken CreateJwtSecurityToken(string issuer = default, string audience = default, System.Security.Claims.ClaimsIdentity subject = default, DateTime? notBefore = default, DateTime? expires = default, DateTime? issuedAt = default, Microsoft.IdentityModel.Tokens.SigningCredentials signingCredentials = default);
abstract member CreateJwtSecurityToken : string * string * System.Security.Claims.ClaimsIdentity * Nullable<DateTime> * Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SigningCredentials -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
override this.CreateJwtSecurityToken : string * string * System.Security.Claims.ClaimsIdentity * Nullable<DateTime> * Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SigningCredentials -> System.IdentityModel.Tokens.Jwt.JwtSecurityToken
Public Overridable Function CreateJwtSecurityToken (Optional issuer As String = Nothing, Optional audience As String = Nothing, Optional subject As ClaimsIdentity = Nothing, Optional notBefore As Nullable(Of DateTime) = Nothing, Optional expires As Nullable(Of DateTime) = Nothing, Optional issuedAt As Nullable(Of DateTime) = Nothing, Optional signingCredentials As SigningCredentials = Nothing) As JwtSecurityToken

Parâmetros

issuer
String

O emissor do token.

audience
String

O público-alvo desse token.

subject
ClaimsIdentity

A origem Claimdo (s) para esse token.

notBefore
Nullable<DateTime>

A hora anterior para esse token.

expires
Nullable<DateTime>

A hora de expiração desse token.

issuedAt
Nullable<DateTime>

O tempo de problema para esse token.

signingCredentials
SigningCredentials

Contém material criptográfico para gerar uma assinatura.

Retornos

Um JwtSecurityToken.

Exceções

If expires<= notBefore.

Comentários

Se Actor não for nulo, uma declaração { actort, 'value' } será adicionada ao conteúdo. CreateActorValue(ClaimsIdentity) para obter detalhes sobre como o valor é criado.

Consulte <seealso cref="T:System.IdentityModel.Tokens.Jwt.JwtHeader"></seealso> para obter detalhes sobre como os HeaderParameters são adicionados ao cabeçalho.

Consulte <seealso cref="T:System.IdentityModel.Tokens.Jwt.JwtPayload"></seealso> para obter detalhes sobre como os valores são adicionados ao conteúdo.

Cada Claim um nos subject adicionados terá Type traduzido de acordo com o mapeamento encontrado em OutboundClaimTypeMap. Adicionar e remover afetará OutboundClaimTypeMap o componente de nome da declaração Json.

SigningCredentials(SecurityKey, String) é usado para assinar RawData.

Aplica-se a