Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​IdentityModel.​Tokens.​SecurityTokenDescriptor
Assembly: Microsoft.IdentityModel.Tokens
Inheritance: object → SecurityTokenDescriptor
Contains some information which used to create a security token.
Properties
public
string
Audience
Gets or sets the value of the {"": audience} claim. Will be combined with <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Audiences" /> and any "Aud" claims in
<see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Claims" /> or <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Subject" /> when creating a token.
public
System.​Collections.​Generic.​IList<​string>
Audiences
Gets the list audiences to include in the token's 'Aud' claim. Will be combined with <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Audiences" /> and any
"Aud" claims in <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Claims" /> or <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Subject" /> when creating a token.
public
string
CompressionAlgorithm
Defines the compression algorithm that will be used to compress the JWT token payload.
public
EncryptingCredentials
EncryptingCredentials
Gets or sets the <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.EncryptingCredentials" /> used to create a encrypted security token.
public
System.​DateTime?
Expires
Gets or sets the value of the 'expiration' claim. This value should be in UTC.
public
string
Issuer
Gets or sets the issuer of this <see cref="T:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor" /> .
public
System.​DateTime?
IssuedAt
Gets or sets the time the security token was issued. This value should be in UTC.
public
System.​DateTime?
NotBefore
Gets or sets the notbefore time for the security token. This value should be in UTC.
public
string
TokenType
Gets or sets the token type.
<remarks> If provided, this will be added as the value for the 'typ' header parameter. In the case of a JWE, this will be added to both the inner (JWS) and the outer token (JWE) header. By default, the value used is 'JWT'.
If <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.AdditionalHeaderClaims" /> also contains 'typ' header claim value, it will override the TokenType provided here.
This value is used only for JWT tokens and not for SAML/SAML2 tokens</remarks>
public
System.​Collections.​Generic.​IDictionary<​string, object>
Claims
Gets or sets the <see cref="T:System.Collections.Generic.Dictionary`2" /> which represents the claims that will be used when creating a security token.
If both <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Claims" /> and <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Subject" /> are set, the claim values in Subject will be combined with the values
in Claims. The values found in Claims take precedence over those found in Subject, so any duplicate
values will be overridden.
public
System.​Collections.​Generic.​IDictionary<​string, object>
AdditionalHeaderClaims
Gets or sets the <see cref="T:System.Collections.Generic.Dictionary`2" /> which contains any custom header claims that need to be added to the JWT token header.
The 'alg', 'kid', 'x5t', 'enc', and 'zip' claims are added by default based on the <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.SigningCredentials" /> ,
<see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.EncryptingCredentials" /> , and/or <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.CompressionAlgorithm" /> provided and SHOULD NOT be included in this dictionary as this
will result in an exception being thrown.
<remarks> These claims are only added to the outer header (in case of a JWE).</remarks>
public
System.​Collections.​Generic.​IDictionary<​string, object>
AdditionalInnerHeaderClaims
Gets or sets the <see cref="T:System.Collections.Generic.Dictionary`2" /> which contains any custom header claims that need to be added to the inner JWT token header.
The 'alg', 'kid', 'x5t', 'enc', and 'zip' claims are added by default based on the <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.SigningCredentials" /> ,
<see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.EncryptingCredentials" /> , and/or <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.CompressionAlgorithm" /> provided and SHOULD NOT be included in this dictionary as this
will result in an exception being thrown.
<remarks>
For JsonWebTokenHandler, these claims are merged with <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.AdditionalHeaderClaims" /> while adding to the inner JWT header.
</remarks>
public
SigningCredentials
SigningCredentials
Gets or sets the <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.SigningCredentials" /> used to create a security token.
Subject
Gets or sets the <see cref="T:System.Security.Claims.ClaimsIdentity" /> .
If both <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Claims" /> and <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor.Subject" /> are set, the claim values in Subject will be combined with the values
in Claims. The values found in Claims take precedence over those found in Subject, so any duplicate
values will be overridden.
Methods
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object