Class JwtValidatorBuilder

    • Method Detail

      • getInstance

        public static JwtValidatorBuilder getInstance​(OAuth2ServiceConfiguration configuration)
        Creates a builder instance that can be configured further.
        Parameters:
        configuration - the identity service configuration
        Returns:
        the builder
      • with

        public JwtValidatorBuilder with​(Validator<Token> validator)
        Adds a custom validator to the validation chain.
        Parameters:
        validator - the validator used for validation.
        Returns:
        this builder.
      • withCacheConfiguration

        public JwtValidatorBuilder withCacheConfiguration​(CacheConfiguration tokenKeyCacheConfiguration)
        Use to configure the token key cache.
        Parameters:
        tokenKeyCacheConfiguration - the cache configuration
        Returns:
        this builder
      • withAudienceValidator

        public JwtValidatorBuilder withAudienceValidator​(Validator<Token> audienceValidator)
        Sets / overwrites the default audience validator.
        Parameters:
        audienceValidator - the validator used for validation.
        Returns:
        this builder.
      • configureAnotherServiceInstance

        public JwtValidatorBuilder configureAnotherServiceInstance​(@Nullable
                                                                   OAuth2ServiceConfiguration otherConfiguration)
        Allows to provide another service configuration, e.g. in case you have multiple Xsuaa identity service instances and you like to accept tokens issued for them as well.
        Parameters:
        otherConfiguration - the configuration of the other service instance, e.g. the broker
        Returns:
        this builder
      • withValidatorListener

        public JwtValidatorBuilder withValidatorListener​(ValidationListener validationListener)
        Adds the validation listener to the jwt validator that is being built.
        Parameters:
        validationListener - the listener to be added to the validator.
        Returns:
        this builder
      • disableTenantIdCheck

        public JwtValidatorBuilder disableTenantIdCheck()
        Disables tenant id check for JwtSignatureValidator. In case Jwt issuer claim doesn't match with the url attribute from OAuth2ServiceConfiguration tenant id (zid) claim needs to be present in token to ensure that the tenant belongs to this issuer. This method disables the tenant id check. Use with caution as it relaxes the validation rules! It is not recommended to disable this check for standard Identity service setup.
        Returns:
        this builder
      • build

        public CombiningValidator<Token> build()
        Builds the validators with the applied parameters.
        Returns:
        the combined validators.