@Singleton public class DefaultIntrospectionProcessor extends java.lang.Object implements IntrospectionProcessor
IntrospectionRequest.getToken() with the available TokenValidator.
Then it creates a IntrospectionResponse with the first Authentication object.
If no TokenValidator is able to validate the token, it tries with RefreshTokenValidator.
If it cannot authenticate it returns {active: false}| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AUDIENCE |
static java.lang.String |
CLIENT_ID |
static java.lang.String |
EXP |
static java.util.List<java.lang.String> |
FIELDS_ATTRIBUTE_NAMES |
static java.lang.String |
ISSUED_AT |
static java.lang.String |
ISSUER |
static java.lang.String |
JWT_ID |
protected static org.slf4j.Logger |
LOG |
static java.lang.String |
NOT_BEFORE |
protected RefreshTokenValidator |
refreshTokenValidator |
static java.lang.String |
SCOPE |
static java.lang.String |
SUBJECT |
static java.lang.String |
TOKEN_TYPE |
protected TokenConfiguration |
tokenConfiguration |
protected java.util.Collection<TokenValidator> |
tokenValidators |
static java.lang.String |
USERNAME |
| Constructor and Description |
|---|
DefaultIntrospectionProcessor(java.util.Collection<TokenValidator> tokenValidators,
TokenConfiguration tokenConfiguration,
RefreshTokenValidator refreshTokenValidator) |
| Modifier and Type | Method and Description |
|---|---|
IntrospectionResponse |
createIntrospectionResponse(Authentication authentication,
io.micronaut.http.HttpRequest<?> httpRequest)
Creates an
IntrospectionResponse for an Authentication. |
org.reactivestreams.Publisher<IntrospectionResponse> |
introspect(Authentication authentication,
io.micronaut.http.HttpRequest<?> httpRequest) |
org.reactivestreams.Publisher<IntrospectionResponse> |
introspect(IntrospectionRequest introspectionRequest,
io.micronaut.http.HttpRequest<?> httpRequest) |
protected void |
populateAud(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with aud claim.
|
protected void |
populateClientId(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response client_id.
|
protected void |
populateExpiration(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with the exp claim of authentication.
|
protected java.util.List<java.lang.String> |
populateFields(Authentication authentication,
IntrospectionResponse introspectionResponse) |
protected void |
populateIssuedAt(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with the iat claim of authentication.
|
protected void |
populateIssuer(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with iss claim.
|
protected void |
populateJwtId(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with jti username.
|
protected void |
populateNotBefore(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with the nbf claim of authentication.
|
protected void |
populateScope(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response scope.
|
protected void |
populateSub(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with sub claim.
|
protected void |
populateTokenType(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response token type.
|
protected void |
populateUsername(Authentication authentication,
IntrospectionResponse introspectionResponse)
Populates the introspection response with the username.
|
protected java.util.Optional<java.lang.Long> |
secondsSinceEpochOfAttribute(java.lang.String attributeName,
Authentication authentication) |
static long |
toSecondsSinceEpoch(java.util.Date date) |
public static final java.lang.String CLIENT_ID
public static final java.lang.String USERNAME
public static final java.lang.String TOKEN_TYPE
public static final java.lang.String ISSUER
public static final java.lang.String SUBJECT
public static final java.lang.String EXP
public static final java.lang.String NOT_BEFORE
public static final java.lang.String ISSUED_AT
public static final java.lang.String JWT_ID
public static final java.lang.String AUDIENCE
public static final java.lang.String SCOPE
public static final java.util.List<java.lang.String> FIELDS_ATTRIBUTE_NAMES
protected static final org.slf4j.Logger LOG
protected final java.util.Collection<TokenValidator> tokenValidators
protected final TokenConfiguration tokenConfiguration
protected final RefreshTokenValidator refreshTokenValidator
public DefaultIntrospectionProcessor(java.util.Collection<TokenValidator> tokenValidators, TokenConfiguration tokenConfiguration, @Nullable RefreshTokenValidator refreshTokenValidator)
@NonNull public org.reactivestreams.Publisher<IntrospectionResponse> introspect(@NonNull IntrospectionRequest introspectionRequest, @NonNull io.micronaut.http.HttpRequest<?> httpRequest)
introspect in interface IntrospectionProcessorintrospectionRequest - A parameter representing the token along with optional parameters representing additional contexthttpRequest - HTTP Request@NonNull public org.reactivestreams.Publisher<IntrospectionResponse> introspect(@NonNull Authentication authentication, @NonNull io.micronaut.http.HttpRequest<?> httpRequest)
introspect in interface IntrospectionProcessorauthentication - The authenticationhttpRequest - HTTP Request@NonNull public IntrospectionResponse createIntrospectionResponse(@NonNull Authentication authentication, @NonNull io.micronaut.http.HttpRequest<?> httpRequest)
IntrospectionResponse for an Authentication.authentication - AuthenticationhttpRequest - HTTP RequestIntrospectionResponse@NonNull
protected java.util.List<java.lang.String> populateFields(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateScope(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateTokenType(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateClientId(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateAud(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateSub(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateIssuer(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateJwtId(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateUsername(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateExpiration(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected java.util.Optional<java.lang.Long> secondsSinceEpochOfAttribute(@NonNull
java.lang.String attributeName,
@NonNull
Authentication authentication)
attributeName - The attribute name e.g. exp nbf iatauthentication - Authenticationprotected void populateNotBefore(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedprotected void populateIssuedAt(@NonNull
Authentication authentication,
@NonNull
IntrospectionResponse introspectionResponse)
authentication - AuthenticationintrospectionResponse - Introspection Response being populatedpublic static long toSecondsSinceEpoch(java.util.Date date)
date - Date