mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-30 08:42:13 +00:00
SEC-2336: WebSecurityConfigurerAdapter#registerAuthentication javadoc fixes
This commit is contained in:
parent
1f3b812a66
commit
56ce7d284c
@ -104,29 +104,50 @@ public abstract class WebSecurityConfigurerAdapter implements SecurityConfigurer
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the default implementation of {@link #authenticationManager()} to attempt to obtain an
|
||||
* {@link AuthenticationManager}. If overridden, the {@link AuthenticationManagerBuilder} should be used to specify
|
||||
* the {@link AuthenticationManager}. The resulting {@link AuthenticationManager}
|
||||
* will be exposed as a Bean as will the last populated {@link UserDetailsService} that is created with the
|
||||
* {@link AuthenticationManagerBuilder}. The {@link UserDetailsService} will also automatically be populated on
|
||||
* {@link HttpSecurity#getSharedObject(Class)} for use with other {@link SecurityContextConfigurer}
|
||||
* (i.e. RememberMeConfigurer )
|
||||
* Used by the default implementation of {@link #authenticationManager()} to
|
||||
* attempt to obtain an {@link AuthenticationManager}. If overridden, the
|
||||
* {@link AuthenticationManagerBuilder} should be used to specify the
|
||||
* {@link AuthenticationManager}.
|
||||
*
|
||||
* <p>For example, the following configuration could be used to register
|
||||
* in memory authentication that exposes an in memory {@link UserDetailsService}:</p>
|
||||
* <p>
|
||||
* The {@link #authenticationManagerBean()} method can be used to expose the
|
||||
* resulting {@link AuthenticationManager} as a Bean. The
|
||||
* {@link #userDetailsServiceBean()} can be used to expose the last
|
||||
* populated {@link UserDetailsService} that is created with the
|
||||
* {@link AuthenticationManagerBuilder} as a Bean. The
|
||||
* {@link UserDetailsService} will also automatically be populated on
|
||||
* {@link HttpSecurity#getSharedObject(Class)} for use with other
|
||||
* {@link SecurityContextConfigurer} (i.e. RememberMeConfigurer )
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For example, the following configuration could be used to register in
|
||||
* memory authentication that exposes an in memory
|
||||
* {@link UserDetailsService}:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* @Override
|
||||
* protected void registerAuthentication(AuthenticationManagerBuilder auth) {
|
||||
* auth
|
||||
* // enable in memory based authentication with a user named "user" and "admin"
|
||||
* // enable in memory based authentication with a user named
|
||||
* // "user" and "admin"
|
||||
* .inMemoryAuthentication()
|
||||
* .withUser("user").password("password").roles("USER").and()
|
||||
* .withUser("admin").password("password").roles("USER", "ADMIN");
|
||||
* .withUser("user").password("password").roles("USER").and()
|
||||
* .withUser("admin").password("password").roles("USER", "ADMIN");
|
||||
* }
|
||||
*
|
||||
* // Expose the UserDetailsService as a Bean
|
||||
* @Bean
|
||||
* @Override
|
||||
* public UserDetailsService userDetailsServiceBean() throws Exception {
|
||||
* return super.userDetailsServiceBean();
|
||||
* }
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @param auth the {@link AuthenticationManagerBuilder} to use
|
||||
* @param auth
|
||||
* the {@link AuthenticationManagerBuilder} to use
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user