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

org.zodiac.autoconfigure.security.http.SecurityHttpAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.security.http;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.security.condition.ConditionalOnSecurityHttpEnabled;
import org.zodiac.commons.util.Classes;

@SpringBootConfiguration
@ConditionalOnSecurityHttpEnabled
//@AutoConfigureAfter(value = {JdbcTemplateAutoConfiguration.class})
@ConditionalOnClass(value = {org.zodiac.security.auth.SecurityAuthAspect.class, org.springframework.jdbc.core.JdbcTemplate.class, org.zodiac.security.SecurityClientDetailsService.class})
public class SecurityHttpAutoConfiguration {

    private final org.springframework.jdbc.core.JdbcTemplate jdbcTemplate;

    public SecurityHttpAutoConfiguration(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    @Bean
    @ConditionalOnMissingBean
    @ConfigurationProperties(prefix = org.zodiac.security.constants.SecuritySystemPropertiesConstants.SPRING_SECURITY_HTTP_PREFIX, ignoreInvalidFields = true)
    protected SecurityHttpProperties securityHttpProperties() {
        return new SecurityHttpProperties();
    }

    @Bean
    @ConditionalOnMissingBean(value = {org.zodiac.security.SecurityClientDetailsService.class})
    protected org.zodiac.security.SecurityClientDetailsService securityClientDetailsService(SecurityHttpProperties securityHttpProperties) {
        boolean swaggerLoaded = Classes.isPresent("io.swagger.annotations.ApiModel");
        return new org.zodiac.security.SecurityClientDetailsServiceImpl(jdbcTemplate, securityHttpProperties.getQueryClientDetailsSql(),
            swaggerLoaded ? org.zodiac.security.http.SwaggerSecurityClientDetails.class : org.zodiac.security.DefaultSecurityClientDetails.class);
    }

    @Bean
    @ConditionalOnMissingBean
    protected org.zodiac.security.auth.SecurityAuthAspect securityAuthAspect() {
        return new org.zodiac.security.auth.SecurityAuthServletAspect();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy