Class TokenSecurity
JWT Security.
Inheritance
Implements
Inherited Members
Namespace: ComponentSpace.OpenID.Security
Assembly: ComponentSpace.OpenID.dll
Syntax
public class TokenSecurity : ITokenSecurity
Constructors
TokenSecurity(ICertificateLoader, CertificateValidators, ILoggerFactory)
Initializes a new instance of the TokenSecurity
class.
Declaration
public TokenSecurity(ICertificateLoader certificateLoader, CertificateValidators certificateValidators, ILoggerFactory loggerFactory)
Parameters
Type | Name | Description |
---|---|---|
ICertificateLoader | certificateLoader | The certificate loader. |
CertificateValidators | certificateValidators | The certificate validators. |
Microsoft.Extensions.Logging.ILoggerFactory | loggerFactory | The logger factory. |
Properties
ClientConfiguration
Gets or sets the client configuration.
Declaration
public virtual ClientConfiguration ClientConfiguration { get; set; }
Property Value
Type | Description |
---|---|
ClientConfiguration | The client configuration. |
ProviderConfiguration
Gets or sets the provider configuration.
Declaration
public virtual ProviderConfiguration ProviderConfiguration { get; set; }
Property Value
Type | Description |
---|---|
ProviderConfiguration | The provider configuration. |
Methods
CreateTokenAsync(SecurityTokenDescriptor)
Creates a token.
Declaration
public virtual Task<string> CreateTokenAsync(SecurityTokenDescriptor securityTokenDescriptor)
Parameters
Type | Name | Description |
---|---|---|
SecurityTokenDescriptor | securityTokenDescriptor | The security token descriptor. |
Returns
Type | Description |
---|---|
Task<System.String> | A task that represents the operation and returns the signing credentials. |
GetEncryptingCredentialsAsync()
Get the encrypting credentials.
Declaration
public virtual async Task<EncryptingCredentials> GetEncryptingCredentialsAsync()
Returns
Type | Description |
---|---|
Task<EncryptingCredentials> | A task that represents the operation and returns the encrypting credentials. |
GetIssuerSigningKeysAsync(Boolean, Boolean)
Gets the issuer signing keys.
Declaration
public virtual async Task<IList<SecurityKey>> GetIssuerSigningKeysAsync(bool includePublicKeys = false, bool includeSymmetricKeys = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | includePublicKeys | The flag indicating whether to include asymmetric public keys. |
System.Boolean | includeSymmetricKeys | The flag indicating whether to include symmetric keys. |
Returns
Type | Description |
---|---|
Task<IList<SecurityKey>> | A task that represents the operation and returns the signing keys. |
GetSigningCredentialsAsync()
Get the signing credentials.
Declaration
public virtual async Task<SigningCredentials> GetSigningCredentialsAsync()
Returns
Type | Description |
---|---|
Task<SigningCredentials> | A task that represents the operation and returns the signing credentials. |
GetTokenDecryptionKeysAsync(Boolean, Boolean)
Gets the token decryption keys.
Declaration
public virtual async Task<IList<SecurityKey>> GetTokenDecryptionKeysAsync(bool includePrivateKeys = false, bool includeSymmetricKeys = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | includePrivateKeys | The flag indicating whether to include asymmetric private keys. |
System.Boolean | includeSymmetricKeys | The flag indicating whether to include symmetric keys. |
Returns
Type | Description |
---|---|
Task<IList<SecurityKey>> | A task that represents the operation and returns the decryption keys. |
ReadToken(String)
Reads a token.
Declaration
public virtual JsonWebToken ReadToken(string token)
Parameters
Type | Name | Description |
---|---|---|
System.String | token | The token string. |
Returns
Type | Description |
---|---|
JsonWebToken | The token. |
ValidateTokenAsync(String, TokenValidationParameters)
Validates a token.
Declaration
public virtual Task<TokenValidationResult> ValidateTokenAsync(string token, TokenValidationParameters tokenValidationParameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | token | The token. |
TokenValidationParameters | tokenValidationParameters | The token validation parameters. |
Returns
Type | Description |
---|---|
Task<TokenValidationResult> | A task that represents the operation and returns the token validation result. |