All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codingapi.springboot.security.jwt.JWTSecurityConfiguration Maven / Gradle / Ivy

There is a newer version: 3.3.14
Show newest version
package com.codingapi.springboot.security.jwt;

import com.codingapi.springboot.security.gateway.TokenGateway;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty(prefix = "codingapi.security.jwt", name = "enable", havingValue = "true")
public class JWTSecurityConfiguration {


    @Bean
    @ConfigurationProperties(prefix = "codingapi.security.jwt")
    public SecurityJWTProperties securityJWTProperties() {
        return new SecurityJWTProperties();
    }


    @Bean
    @ConditionalOnMissingBean
    public JwtTokenGateway jwtTokenGateway(SecurityJWTProperties properties) {
        return new JwtTokenGateway(properties);
    }


    @Bean
    @ConditionalOnMissingBean
    public TokenGateway jwtTokenGatewayImpl(JwtTokenGateway jwtTokenGateway) {
        return new JWTTokenGatewayImpl(jwtTokenGateway);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy