Clarify how to switch off security autoconfiguration
The fact that the web security and the authentication manager are controlled separately should hopefully now be clearer. Fixes gh-3292
This commit is contained in:
@@ -23,7 +23,6 @@ import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -52,11 +51,13 @@ import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* Configuration for a Spring Security in-memory {@link AuthenticationManager}. Can be
|
||||
* disabled by providing a bean of type AuthenticationManager. The value provided by this
|
||||
* configuration will become the "global" authentication manager (from Spring Security),
|
||||
* or the parent of the global instance. Thus it acts as a fallback when no others are
|
||||
* provided, is used by method security if enabled, and as a parent authentication manager
|
||||
* for "local" authentication managers in individual filter chains.
|
||||
* disabled by providing a bean of type AuthenticationManager, or by autowiring an
|
||||
* {@link AuthenticationManagerBuilder} into a method in one of your configuration
|
||||
* classes. The value provided by this configuration will become the "global"
|
||||
* authentication manager (from Spring Security), or the parent of the global instance.
|
||||
* Thus it acts as a fallback when no others are provided, is used by method security if
|
||||
* enabled, and as a parent authentication manager for "local" authentication managers in
|
||||
* individual filter chains.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Rob Winch
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.WebSecurityConfigurer;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
@@ -60,8 +61,7 @@ import org.springframework.util.StringUtils;
|
||||
* externalized application properties (or via an bean definition of that type to set the
|
||||
* defaults). The user details for authentication are just placeholders
|
||||
* {@code (username=user, password=password)} but can easily be customized by providing a
|
||||
* bean definition of type {@link AuthenticationManager}. Also provides audit logging of
|
||||
* authentication events.
|
||||
* an {@link AuthenticationManager}. Also provides audit logging of authentication events.
|
||||
* <p>
|
||||
* Some common simple customizations:
|
||||
* <ul>
|
||||
@@ -69,7 +69,9 @@ import org.springframework.util.StringUtils;
|
||||
* classpath or {@link EnableAutoConfiguration#exclude() exclude} this configuration.</li>
|
||||
* <li>Switch off security temporarily (e.g. for a dev environment): set
|
||||
* {@code security.basic.enabled: false}</li>
|
||||
* <li>Customize the user details: add an AuthenticationManager bean</li>
|
||||
* <li>Customize the user details: autowire an {@link AuthenticationManagerBuilder} into a
|
||||
* method in one of your configuration classes or equivalently add a bean of type
|
||||
* AuthenticationManager</li>
|
||||
* <li>Add form login for user facing resources: add a
|
||||
* {@link WebSecurityConfigurerAdapter} and use {@link HttpSecurity#formLogin()}</li>
|
||||
* </ul>
|
||||
|
||||
Reference in New Issue
Block a user