Class JwtSupportAutoConfiguration


  • @ConditionalOnWebApplication(type=SERVLET)
    @ConditionalOnClass({org.springframework.boot.web.client.RestTemplateBuilder.class,org.bremersee.security.authentication.JsonPathJwtConverter.class,org.bremersee.security.authentication.RestTemplateAccessTokenRetriever.class})
    @Configuration
    @EnableConfigurationProperties({AuthProperties.class,MessageSourceProperties.class})
    public class JwtSupportAutoConfiguration
    extends Object
    The authentication support auto configuration.
    Author:
    Christian Bremer
    • Constructor Detail

      • JwtSupportAutoConfiguration

        public JwtSupportAutoConfiguration​(AuthProperties properties)
        Instantiates a new authentication support auto configuration.
        Parameters:
        properties - the properties
    • Method Detail

      • init

        @EventListener(org.springframework.boot.context.event.ApplicationReadyEvent.class)
        public void init()
        Init.
      • authenticationDetails

        @ConditionalOnMissingBean
        @Bean
        public org.bremersee.security.authentication.AuthenticationDetails authenticationDetails​(MessageSourceProperties messageSourceProperties)
        Creates authentication details bean.
        Parameters:
        messageSourceProperties - the message source properties
        Returns:
        the authentication details
      • jsonPathJwtConverter

        @ConditionalOnProperty(prefix="spring.security.oauth2.resourceserver.jwt",
                               name="jwk-set-uri")
        @ConditionalOnMissingBean
        @Bean
        public org.bremersee.security.authentication.JsonPathJwtConverter jsonPathJwtConverter()
        Creates a json path jwt converter bean.
        Returns:
        the json path jwt converter
      • restTemplateAccessTokenRetriever

        @Conditional(JwtSupportCondition.class)
        @ConditionalOnMissingBean
        @Bean
        public org.bremersee.security.authentication.RestTemplateAccessTokenRetriever restTemplateAccessTokenRetriever​(org.springframework.beans.factory.ObjectProvider<org.springframework.boot.web.client.RestTemplateBuilder> restTemplateBuilder,
                                                                                                                       org.springframework.beans.factory.ObjectProvider<org.bremersee.security.authentication.AccessTokenCache> accessTokenCache)
        Creates access token retriever.
        Parameters:
        restTemplateBuilder - the rest template builder
        accessTokenCache - the access token cache
        Returns:
        the rest template access token retriever
      • passwordFlowAuthenticationManager

        @ConditionalOnProperty(prefix="bremersee.auth.password-flow",
                               name={"token-endpoint","client-id","client-secret"})
        @ConditionalOnBean(org.bremersee.security.authentication.JsonPathJwtConverter.class)
        @ConditionalOnMissingBean(PasswordFlowAuthenticationManager.class)
        @Bean
        public PasswordFlowAuthenticationManager passwordFlowAuthenticationManager​(org.springframework.beans.factory.ObjectProvider<org.springframework.security.oauth2.jwt.JwtDecoder> jwtDecoder,
                                                                                   org.bremersee.security.authentication.JsonPathJwtConverter jwtConverter,
                                                                                   org.bremersee.security.authentication.RestTemplateAccessTokenRetriever tokenRetriever)
        Creates a password flow authentication manager.
        Parameters:
        jwtDecoder - the jwt decoder
        jwtConverter - the jwt converter
        tokenRetriever - the token retriever
        Returns:
        the password flow authentication manager