Class JWTCredentialValidator

    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • clientAuthContextLookupStrategy

        @Nonnull
        private Function<ProfileRequestContext,​net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext> clientAuthContextLookupStrategy
        Strategy that will return OAuth2ClientAuthenticationContext.
      • claimsValidatorLookupStrategy

        @Nonnull
        private Function<ProfileRequestContext,​net.shibboleth.oidc.jwt.claims.ClaimsValidator> claimsValidatorLookupStrategy
        Strategy used to obtain ClaimsValidator.
      • saveTokenToCredentialSet

        private boolean saveTokenToCredentialSet
        Whether to save the JWT in the Java Subject's public credentials.
    • Constructor Detail

      • JWTCredentialValidator

        public JWTCredentialValidator()
        Constructor.
    • Method Detail

      • setOAuth2ClientAuthenticationLookupStrategy

        public void setOAuth2ClientAuthenticationLookupStrategy​(@Nonnull
                                                                Function<ProfileRequestContext,​net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext> strategy)
        Set the strategy used to return the OAuth2ClientAuthenticationContext.
        Parameters:
        strategy - lookup strategy
      • setClaimsValidatorLookupStrategy

        public void setClaimsValidatorLookupStrategy​(@Nonnull
                                                     Function<ProfileRequestContext,​net.shibboleth.oidc.jwt.claims.ClaimsValidator> strategy)
        Set the strategy used to locate ClaimsValidator used.
        Parameters:
        strategy - lookup strategy
      • setSaveTokenToCredentialSet

        public void setSaveTokenToCredentialSet​(boolean flag)
        Set whether to save the JWT in the Java Subject's public credentials.

        Defaults to true

        Parameters:
        flag - flag to set
      • doValidate

        @Nullable
        protected Subject doValidate​(@Nonnull
                                     ProfileRequestContext profileRequestContext,
                                     @Nonnull
                                     net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext,
                                     @Nullable
                                     net.shibboleth.idp.authn.CredentialValidator.WarningHandler warningHandler,
                                     @Nullable
                                     net.shibboleth.idp.authn.CredentialValidator.ErrorHandler errorHandler)
                              throws Exception
        Specified by:
        doValidate in class net.shibboleth.idp.authn.AbstractCredentialValidator
        Throws:
        Exception
      • validateJWTClaims

        protected void validateJWTClaims​(@Nonnull
                                         ProfileRequestContext profileRequestContext,
                                         @Nonnull
                                         com.nimbusds.jwt.SignedJWT jwt,
                                         @Nonnull
                                         com.nimbusds.oauth2.sdk.id.ClientID clientId)
                                  throws ParseException,
                                         net.shibboleth.oidc.jwt.claims.JWTValidationException
        Validates the contents of the given JWT against the requirements set in the OIDC core specification section 9.
        Parameters:
        jwt - JWT to be validated
        clientId - client ID from which the JWT is coming from
        profileRequestContext - profile request context
        Throws:
        ParseException - if unable to parse the claim set
        net.shibboleth.oidc.jwt.claims.JWTValidationException - if the claims fail to validate
      • populateSubject

        @Nonnull
        protected Subject populateSubject​(@Nonnull @NotEmpty
                                          com.nimbusds.oauth2.sdk.id.ClientID clientId,
                                          @Nonnull
                                          com.nimbusds.jwt.SignedJWT token)
        Builds a subject with "standard" content from the validation.
        Parameters:
        clientId - client ID
        token - the token validated
        Returns:
        the decorated subject