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

com.codingapi.springboot.security.redis.RedisSecurityConfiguration Maven / Gradle / Ivy

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

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;
import org.springframework.data.redis.core.RedisTemplate;

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


    @Bean
    @ConfigurationProperties(prefix = "codingapi.security.redis")
    public SecurityRedisProperties securityRedisProperties() {
        return new SecurityRedisProperties();
    }


    @Bean
    @ConditionalOnMissingBean
    public RedisTokenGateway redisTokenGateway(RedisTemplate redisTemplate, SecurityRedisProperties properties) {
        return new RedisTokenGateway(redisTemplate, properties);
    }

    @Bean
    @ConditionalOnMissingBean
    public TokenGateway redisTokenGatewayImpl(RedisTokenGateway redisTokenGateway) {
        return new RedisTokenGatewayImpl(redisTokenGateway);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy