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

org.zodiac.autoconfigure.security.SecurityWebAutoConfiguration Maven / Gradle / Ivy

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

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.zodiac.autoconfigure.security.condition.ConditionalOnSecurityConfigEnabled;

/**
 * {@link org.springframework.boot.autoconfigure.security.SecurityProperties#BASIC_AUTH_ORDER}会使
 * {@link org.springframework.boot.autoconfigure.security.servlet.SpringBootWebSecurityConfiguration} 中的
 * {@code DefaultConfigurerAdapter}生效,从而默认开启{@code HTTP Basic}认证。
 *
 */
@org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
@ConditionalOnSecurityConfigEnabled
@SpringBootConfiguration
@ConditionalOnWebApplication(type = Type.SERVLET)
@Order(value = org.zodiac.security.constants.SecurityOrderConstants.DEFAULT_PERMIT_ALL_ORDER)
// @ConditionalOnMissingBean(value =
// {org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.class})
@ConditionalOnClass(value = {
    org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.class,
    org.springframework.security.core.Authentication.class,
    org.springframework.security.config.annotation.SecurityBuilder.class,
    org.springframework.security.web.SecurityFilterChain.class, org.zodiac.security.config.SecurityConfigInfo.class})
public class SecurityWebAutoConfiguration extends org.zodiac.security.config.SecurityWebConfigurer {

    @Autowired
    protected SecurityProperties securityProperties;

    public SecurityWebAutoConfiguration() {
        super();
    }

    public SecurityWebAutoConfiguration(boolean disableDefaults) {
        super(disableDefaults);
    }

    @Bean
    @Override
    public org.springframework.security.authentication.AuthenticationManager authenticationManagerBean()
        throws Exception {
        return super.authenticationManagerBean();
    }

    // @Bean
    @Override
    protected org.springframework.security.authentication.AuthenticationManager authenticationManager()
        throws Exception {
        return super.authenticationManager();
    }

    // @Bean
    @Override
    protected org.springframework.security.authentication.AuthenticationManager authenticationManager(
        ObjectProvider<
            org.springframework.security.authentication.AuthenticationProvider> authenticationProviderProvider,
        ObjectProvider eventPublisherProvider)
        throws Exception {
        return super.authenticationManager(authenticationProviderProvider, eventPublisherProvider);
    }

    @Bean
    @Override
    protected org.springframework.security.web.authentication.AuthenticationFailureHandler
        authenticationFailureHandler() {
        return super.authenticationFailureHandler();
    }

    @Bean
    @Override
    protected org.springframework.security.web.authentication.AuthenticationSuccessHandler
        authenticationSuccessHandler() {
        return super.authenticationSuccessHandler();
    }

    @Bean
    @Override
    protected org.springframework.security.web.authentication.session.SessionAuthenticationStrategy
        sessionAuthenticationStrategy() {
        return super.sessionAuthenticationStrategy();
    }

    @Bean
    @Override
    protected org.springframework.security.authentication.AuthenticationDetailsSource authenticationDetailsSource() {
        return super.authenticationDetailsSource();
    }

    @Bean
    @Override
    protected org.zodiac.security.auth.authentication.servlet.SecurityRememberMeServices
        rememberMeServices(org.springframework.security.core.userdetails.UserDetailsService userDetailsService) {
        return super.rememberMeServices(userDetailsService);
    }

    @Bean
    @ConditionalOnMissingBean
    @Override
    protected org.zodiac.security.auth.authentication.servlet.ServletAuthenticationHandler authenticationHandler(
        org.springframework.security.web.authentication.AuthenticationFailureHandler failureHandler,
        org.springframework.security.web.authentication.AuthenticationSuccessHandler successHandler,
        org.springframework.security.authentication.AuthenticationManager authenticationManager,
        org.springframework.security.core.userdetails.UserDetailsService userDetailsService,
        org.zodiac.security.auth.authentication.servlet.SecurityRememberMeServices rememberMeServices,
        org.springframework.security.web.authentication.session.SessionAuthenticationStrategy sessionStrategy,
        ApplicationEventPublisher eventPublisher,
        org.springframework.security.authentication.AuthenticationDetailsSource authenticationDetailsSource) {
        return super.authenticationHandler(failureHandler, successHandler, authenticationManager, userDetailsService,
            rememberMeServices, sessionStrategy, eventPublisher, authenticationDetailsSource);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy