Table of Contents

Class ClaimsBearerTokenExtractor

Namespace
Arc4u.OAuth2.Security.Principal
Assembly
Arc4u.OAuth2.dll

An IClaimsFiller that extracts the claims of a JWT access token. The token is taken from the BootstrapContext of the identity or, when there is none, requested from the ITokenProvider registered for the identity authentication type.

[Export(typeof(IClaimsFiller))]
public class ClaimsBearerTokenExtractor : IClaimsFiller
Inheritance
ClaimsBearerTokenExtractor
Implements
Inherited Members

Constructors

ClaimsBearerTokenExtractor(IOptionsMonitor<SimpleKeyValueSettings>, IServiceProvider, ILogger<ClaimsBearerTokenExtractor>)

Initializes a new instance of the ClaimsBearerTokenExtractor class.

public ClaimsBearerTokenExtractor(IOptionsMonitor<SimpleKeyValueSettings> settings, IServiceProvider serviceProvider, ILogger<ClaimsBearerTokenExtractor> logger)

Parameters

settings IOptionsMonitor<SimpleKeyValueSettings>

The named token provider settings, keyed by authentication type.

serviceProvider IServiceProvider

The service provider used to resolve the keyed ITokenProvider.

logger ILogger<ClaimsBearerTokenExtractor>

The logger.

Methods

GetAsync(IIdentity)

Reads the claims contained in the access token of the identity.

public Task<IEnumerable<ClaimDto>> GetAsync(IIdentity identity)

Parameters

identity IIdentity

The identity for which the claims are loaded. It must be a ClaimsIdentity.

Returns

Task<IEnumerable<ClaimDto>>

The claims found in the token. The list is empty when the identity is not a ClaimsIdentity, no token provider is configured for it, or the token cannot be obtained.

Exceptions

ArgumentNullException

identity is null.