Class DefaultIntrospectionProcessor
java.lang.Object
io.micronaut.security.endpoints.introspection.DefaultIntrospectionProcessor
- All Implemented Interfaces:
 IntrospectionProcessor
@Singleton
public class DefaultIntrospectionProcessor
extends Object
implements IntrospectionProcessor
Validates the 
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}- Since:
 - 2.1.0
 - Author:
 - Sergio del Amo
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected static final org.slf4j.Loggerstatic final Stringprotected final RefreshTokenValidatorstatic final Stringstatic final Stringstatic final Stringprotected final TokenConfigurationprotected final Collection<TokenValidator>static final String - 
Constructor Summary
ConstructorsConstructorDescriptionDefaultIntrospectionProcessor(Collection<TokenValidator> tokenValidators, TokenConfiguration tokenConfiguration, RefreshTokenValidator refreshTokenValidator)  - 
Method Summary
Modifier and TypeMethodDescriptioncreateIntrospectionResponse(Authentication authentication, io.micronaut.http.HttpRequest<?> httpRequest) Creates anIntrospectionResponsefor anAuthentication.protected IntrospectionResponseemptyIntrospectionResponse(String token) Empty response for introspection response.org.reactivestreams.Publisher<IntrospectionResponse>introspect(Authentication authentication, io.micronaut.http.HttpRequest<?> httpRequest) org.reactivestreams.Publisher<IntrospectionResponse>introspect(IntrospectionRequest introspectionRequest, io.micronaut.http.HttpRequest<?> httpRequest) resolveAud(Authentication authentication) Populates the introspection response with aud claim.resolveClientId(Authentication authentication) Populates the introspection response client_id.resolveExpiration(Authentication authentication) Populates the introspection response with the exp claim of authentication.resolveExtensions(Authentication authentication) resolveIssuedAt(Authentication authentication) Populates the introspection response with the iat claim of authentication.resolveIssuer(Authentication authentication) Populates the introspection response with iss claim.resolveJwtId(Authentication authentication) Populates the introspection response with jti username.resolveNotBefore(Authentication authentication) Populates the introspection response with the nbf claim of authentication.resolveScope(Authentication authentication) Populates the introspection response scope.protected StringresolveSub(Authentication authentication) Populates the introspection response with sub claim.resolveTokenType(Authentication authentication) Populates the introspection response token type.resolveUsername(Authentication authentication) Populates the introspection response with the username.secondsSinceEpochOfAttribute(String attributeName, Authentication authentication) static longtoSecondsSinceEpoch(Date date)  
- 
Field Details
- 
CLIENT_ID
- See Also:
 
 - 
USERNAME
- See Also:
 
 - 
TOKEN_TYPE
- See Also:
 
 - 
ISSUER
- See Also:
 
 - 
SUBJECT
- See Also:
 
 - 
EXP
- See Also:
 
 - 
NOT_BEFORE
- See Also:
 
 - 
ISSUED_AT
- See Also:
 
 - 
JWT_ID
- See Also:
 
 - 
AUDIENCE
- See Also:
 
 - 
SCOPE
- See Also:
 
 - 
FIELDS_ATTRIBUTE_NAMES
 - 
LOG
protected static final org.slf4j.Logger LOG - 
tokenValidators
 - 
tokenConfiguration
 - 
refreshTokenValidator
 
 - 
 - 
Constructor Details
- 
DefaultIntrospectionProcessor
public DefaultIntrospectionProcessor(Collection<TokenValidator> tokenValidators, TokenConfiguration tokenConfiguration, @Nullable RefreshTokenValidator refreshTokenValidator)  
 - 
 - 
Method Details
- 
introspect
@NonNull public org.reactivestreams.Publisher<IntrospectionResponse> introspect(@NonNull IntrospectionRequest introspectionRequest, @NonNull io.micronaut.http.HttpRequest<?> httpRequest) - Specified by:
 introspectin interfaceIntrospectionProcessor- Parameters:
 introspectionRequest- A parameter representing the token along with optional parameters representing additional contexthttpRequest- HTTP Request- Returns:
 - Introspection Response
 
 - 
emptyIntrospectionResponse
Empty response for introspection response.- Parameters:
 token- Token- Returns:
 - Introspection Response
 
 - 
introspect
@NonNull public org.reactivestreams.Publisher<IntrospectionResponse> introspect(@NonNull Authentication authentication, @NonNull io.micronaut.http.HttpRequest<?> httpRequest) - Specified by:
 introspectin interfaceIntrospectionProcessor- Parameters:
 authentication- The authenticationhttpRequest- HTTP Request- Returns:
 - Introspection Response
 
 - 
createIntrospectionResponse
@NonNull public IntrospectionResponse createIntrospectionResponse(@NonNull Authentication authentication, @NonNull io.micronaut.http.HttpRequest<?> httpRequest) Creates anIntrospectionResponsefor anAuthentication.- Parameters:
 authentication- AuthenticationhttpRequest- HTTP Request- Returns:
 - an 
IntrospectionResponse 
 - 
resolveExtensions
- Parameters:
 authentication- Authentication- Returns:
 - Introspection response extensions
 
 - 
resolveScope
Populates the introspection response scope.- Parameters:
 authentication- Authentication- Returns:
 - the scope
 
 - 
resolveTokenType
Populates the introspection response token type.- Parameters:
 authentication- Authentication- Returns:
 - the Token type
 
 - 
resolveClientId
Populates the introspection response client_id.- Parameters:
 authentication- Authentication- Returns:
 - client_id value
 
 - 
resolveAud
Populates the introspection response with aud claim.- Parameters:
 authentication- Authentication- Returns:
 - value of aud claim
 
 - 
resolveSub
Populates the introspection response with sub claim.- Parameters:
 authentication- Authentication- Returns:
 - value of sub claim
 
 - 
resolveIssuer
Populates the introspection response with iss claim.- Parameters:
 authentication- Authentication- Returns:
 - value of iss claim
 
 - 
resolveJwtId
Populates the introspection response with jti username.- Parameters:
 authentication- Authentication- Returns:
 - the jti claim value
 
 - 
resolveUsername
Populates the introspection response with the username.- Parameters:
 authentication- Authentication- Returns:
 - the username
 
 - 
resolveExpiration
Populates the introspection response with the exp claim of authentication.- Parameters:
 authentication- Authentication- Returns:
 - the exp claim
 
 - 
secondsSinceEpochOfAttribute
protected Optional<Long> secondsSinceEpochOfAttribute(@NonNull String attributeName, @NonNull Authentication authentication) - Parameters:
 attributeName- The attribute name e.g. exp nbf iatauthentication- Authentication- Returns:
 - An empty optional if the authentication attribute is not found or it cannot be transformed to epoch seconds
 
 - 
resolveNotBefore
Populates the introspection response with the nbf claim of authentication.- Parameters:
 authentication- Authentication- Returns:
 - value for nbf claim
 
 - 
resolveIssuedAt
Populates the introspection response with the iat claim of authentication.- Parameters:
 authentication- Authentication- Returns:
 - value for iat claim
 
 - 
toSecondsSinceEpoch
- Parameters:
 date- Date- Returns:
 - seconds since epoch
 
 
 -