Class DefaultIntrospectionProcessor

    • Method Detail

      • introspect

        @NonNull
        public org.reactivestreams.Publisher<IntrospectionResponse> introspect​(@NonNull
                                                                               IntrospectionRequest introspectionRequest,
                                                                               @NonNull
                                                                               io.micronaut.http.HttpRequest<?> httpRequest)
        Specified by:
        introspect in interface IntrospectionProcessor
        Parameters:
        introspectionRequest - A parameter representing the token along with optional parameters representing additional context
        httpRequest - HTTP Request
        Returns:
        Introspection Response
      • introspect

        @NonNull
        public org.reactivestreams.Publisher<IntrospectionResponse> introspect​(@NonNull
                                                                               Authentication authentication,
                                                                               @NonNull
                                                                               io.micronaut.http.HttpRequest<?> httpRequest)
        Specified by:
        introspect in interface IntrospectionProcessor
        Parameters:
        authentication - The authentication
        httpRequest - HTTP Request
        Returns:
        Introspection Response
      • populateFields

        @NonNull
        protected java.util.List<java.lang.String> populateFields​(@NonNull
                                                                  Authentication authentication,
                                                                  @NonNull
                                                                  IntrospectionResponse introspectionResponse)
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
        Returns:
        A list of attribute names already processed
      • populateScope

        protected void populateScope​(@NonNull
                                     Authentication authentication,
                                     @NonNull
                                     IntrospectionResponse introspectionResponse)
        Populates the introspection response scope.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateTokenType

        protected void populateTokenType​(@NonNull
                                         Authentication authentication,
                                         @NonNull
                                         IntrospectionResponse introspectionResponse)
        Populates the introspection response token type.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateClientId

        protected void populateClientId​(@NonNull
                                        Authentication authentication,
                                        @NonNull
                                        IntrospectionResponse introspectionResponse)
        Populates the introspection response client_id.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateAud

        protected void populateAud​(@NonNull
                                   Authentication authentication,
                                   @NonNull
                                   IntrospectionResponse introspectionResponse)
        Populates the introspection response with aud claim.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateSub

        protected void populateSub​(@NonNull
                                   Authentication authentication,
                                   @NonNull
                                   IntrospectionResponse introspectionResponse)
        Populates the introspection response with sub claim.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateIssuer

        protected void populateIssuer​(@NonNull
                                      Authentication authentication,
                                      @NonNull
                                      IntrospectionResponse introspectionResponse)
        Populates the introspection response with iss claim.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateJwtId

        protected void populateJwtId​(@NonNull
                                     Authentication authentication,
                                     @NonNull
                                     IntrospectionResponse introspectionResponse)
        Populates the introspection response with jti username.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateUsername

        protected void populateUsername​(@NonNull
                                        Authentication authentication,
                                        @NonNull
                                        IntrospectionResponse introspectionResponse)
        Populates the introspection response with the username.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateExpiration

        protected void populateExpiration​(@NonNull
                                          Authentication authentication,
                                          @NonNull
                                          IntrospectionResponse introspectionResponse)
        Populates the introspection response with the exp claim of authentication.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • secondsSinceEpochOfAttribute

        protected java.util.Optional<java.lang.Long> secondsSinceEpochOfAttribute​(@NonNull
                                                                                  java.lang.String attributeName,
                                                                                  @NonNull
                                                                                  Authentication authentication)
        Parameters:
        attributeName - The attribute name e.g. exp nbf iat
        authentication - Authentication
        Returns:
        An empty optional if the authentication attribute is not found or it cannot be transformed to epoch seconds
      • populateNotBefore

        protected void populateNotBefore​(@NonNull
                                         Authentication authentication,
                                         @NonNull
                                         IntrospectionResponse introspectionResponse)
        Populates the introspection response with the nbf claim of authentication.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • populateIssuedAt

        protected void populateIssuedAt​(@NonNull
                                        Authentication authentication,
                                        @NonNull
                                        IntrospectionResponse introspectionResponse)
        Populates the introspection response with the iat claim of authentication.
        Parameters:
        authentication - Authentication
        introspectionResponse - Introspection Response being populated
      • toSecondsSinceEpoch

        public static long toSecondsSinceEpoch​(java.util.Date date)
        Parameters:
        date - Date
        Returns:
        seconds since epoch