SEC-2365: registerAuthentication->configure

This commit is contained in:
Rob Winch 2013-10-16 13:59:56 -05:00
parent db3c626ac9
commit 348e3a22b6
42 changed files with 109 additions and 165 deletions

View File

@ -53,8 +53,7 @@ class LdapAuthenticationProviderBuilderSecurityBuilderTests extends BaseSpringSp
@Configuration
static class DefaultLdapConfig extends BaseLdapProviderConfig {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource(contextSource())
@ -71,7 +70,7 @@ class LdapAuthenticationProviderBuilderSecurityBuilderTests extends BaseSpringSp
@Configuration
static class GroupRolesConfig extends BaseLdapProviderConfig {
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource(contextSource())
@ -89,8 +88,7 @@ class LdapAuthenticationProviderBuilderSecurityBuilderTests extends BaseSpringSp
@Configuration
static class GroupSearchConfig extends BaseLdapProviderConfig {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource(contextSource())
@ -108,8 +106,7 @@ class LdapAuthenticationProviderBuilderSecurityBuilderTests extends BaseSpringSp
@Configuration
static class RolePrefixConfig extends BaseLdapProviderConfig {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource(contextSource())
@ -128,8 +125,7 @@ class LdapAuthenticationProviderBuilderSecurityBuilderTests extends BaseSpringSp
@Configuration
static class BindAuthenticationConfig extends BaseLdapServerConfig {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource(contextSource())
@ -154,15 +150,6 @@ class LdapAuthenticationProviderBuilderSecurityBuilderTests extends BaseSpringSp
@Configuration
static abstract class BaseLdapProviderConfig {
@Bean
public AuthenticationManager authenticationManager() {
AuthenticationManagerBuilder registry = new AuthenticationManagerBuilder();
registerAuthentication(registry);
return registry.build();
}
protected abstract void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception;
@Bean
public BaseLdapPathContextSource contextSource() throws Exception {

View File

@ -31,8 +31,7 @@ public class NamespaceLdapAuthenticationProviderTestsConfigs {
@Configuration
@EnableWebSecurity
static class LdapAuthenticationProviderConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.groupSearchBase("ou=groups")
@ -43,8 +42,7 @@ public class NamespaceLdapAuthenticationProviderTestsConfigs {
@Configuration
@EnableWebSecurity
static class CustomLdapAuthenticationProviderConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.groupRoleAttribute("cn") // ldap-authentication-provider@group-role-attribute
@ -70,8 +68,7 @@ public class NamespaceLdapAuthenticationProviderTestsConfigs {
@Configuration
@EnableWebSecurity
static class PasswordCompareLdapConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.groupSearchBase("ou=groups")

View File

@ -236,8 +236,8 @@ public class GlobalMethodSecurityConfiguration implements ImportAware {
/**
* Allows providing a custom {@link AuthenticationManager}. The default is
* to use any authentication mechanisms registered by {@link #registerAuthentication(AuthenticationManagerBuilder)}. If
* {@link #registerAuthentication(AuthenticationManagerBuilder)} was not overriden, then an {@link AuthenticationManager}
* to use any authentication mechanisms registered by {@link #configure(AuthenticationManagerBuilder)}. If
* {@link #configure(AuthenticationManagerBuilder)} was not overridden, then an {@link AuthenticationManager}
* is attempted to be autowired by type.
*
* @return
@ -247,7 +247,7 @@ public class GlobalMethodSecurityConfiguration implements ImportAware {
DefaultAuthenticationEventPublisher eventPublisher = objectPostProcessor.postProcess(new DefaultAuthenticationEventPublisher());
auth.authenticationEventPublisher(eventPublisher);
auth.objectPostProcessor(objectPostProcessor);
registerAuthentication(auth);
configure(auth);
if(!disableAuthenticationRegistry) {
authenticationManager = auth.build();
}
@ -267,13 +267,13 @@ public class GlobalMethodSecurityConfiguration implements ImportAware {
/**
* Sub classes can override this method to register different types of authentication. If not overridden,
* {@link #registerAuthentication(AuthenticationManagerBuilder)} will attempt to autowire by type.
* {@link #configure(AuthenticationManagerBuilder)} will attempt to autowire by type.
*
* @param auth the {@link AuthenticationManagerBuilder} used to register different authentication mechanisms for the
* global method security.
* @throws Exception
*/
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
this.disableAuthenticationRegistry = true;
}

View File

@ -98,7 +98,7 @@ import org.springframework.util.Assert;
* }
*
* @Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
* protected void configure(AuthenticationManagerBuilder auth) throws Exception {
* auth
* .inMemoryAuthentication()
* .withUser("user")
@ -157,7 +157,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
* protected void configure(AuthenticationManagerBuilder auth) throws Exception {
* auth
* .inMemoryAuthentication()
* // the username must match the OpenID of the user you are
@ -345,7 +345,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth.
* inMemoryAuthentication()
@ -417,7 +417,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
* protected void configure(AuthenticationManagerBuilder auth) throws Exception {
* auth
* .inMemoryAuthentication()
* .withUser(&quot;user&quot;)
@ -559,7 +559,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* public class RememberMeSecurityConfig extends WebSecurityConfigurerAdapter {
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -615,7 +615,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -650,7 +650,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -797,7 +797,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -845,7 +845,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -878,7 +878,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -923,7 +923,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -956,7 +956,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -1005,7 +1005,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -1048,7 +1048,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -1163,7 +1163,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -1194,7 +1194,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()
@ -1227,7 +1227,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth)
* protected void configure(AuthenticationManagerBuilder auth)
* throws Exception {
* auth
* .inMemoryAuthentication()

View File

@ -56,7 +56,7 @@ import org.springframework.security.config.annotation.web.WebSecurityConfigurer;
* }
*
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth) {
* protected void configure(AuthenticationManagerBuilder auth) {
* auth
* // enable in memory based authentication with a user named "user" and "admin"
* .inMemoryAuthentication()

View File

@ -131,7 +131,7 @@ public abstract class WebSecurityConfigurerAdapter implements SecurityConfigurer
*
* <pre>
* &#064;Override
* protected void registerAuthentication(AuthenticationManagerBuilder auth) {
* protected void configure(AuthenticationManagerBuilder auth) {
* auth
* // enable in memory based authentication with a user named
* // &quot;user&quot; and &quot;admin&quot;
@ -153,7 +153,7 @@ public abstract class WebSecurityConfigurerAdapter implements SecurityConfigurer
* the {@link AuthenticationManagerBuilder} to use
* @throws Exception
*/
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
this.disableAuthenticationRegistration = true;
}
@ -201,7 +201,7 @@ public abstract class WebSecurityConfigurerAdapter implements SecurityConfigurer
/**
* Override this method to expose the {@link AuthenticationManager} from
* {@link #registerAuthentication(AuthenticationManagerBuilder)} to be exposed as
* {@link #configure(AuthenticationManagerBuilder)} to be exposed as
* a Bean. For example:
*
* <pre>
@ -221,7 +221,7 @@ public abstract class WebSecurityConfigurerAdapter implements SecurityConfigurer
/**
* Gets the {@link AuthenticationManager} to use. The default strategy is if
* {@link #registerAuthentication(AuthenticationManagerBuilder)} method is
* {@link #configure(AuthenticationManagerBuilder)} method is
* overridden to use the {@link AuthenticationManagerBuilder} that was passed in.
* Otherwise, autowire the {@link AuthenticationManager} by type.
*
@ -230,7 +230,7 @@ public abstract class WebSecurityConfigurerAdapter implements SecurityConfigurer
*/
protected AuthenticationManager authenticationManager() throws Exception {
if(!authenticationManagerInitialized) {
registerAuthentication(parentAuthenticationBuilder);
configure(parentAuthenticationBuilder);
if(disableAuthenticationRegistration) {
try {
authenticationManager = context.getBean(AuthenticationManagerBuilder.class).getOrBuild();
@ -254,7 +254,7 @@ public abstract class WebSecurityConfigurerAdapter implements SecurityConfigurer
/**
* Override this method to expose a {@link UserDetailsService} created from
* {@link #registerAuthentication(AuthenticationManagerBuilder)} as a bean. In
* {@link #configure(AuthenticationManagerBuilder)} as a bean. In
* general only the following override should be done of this method:
*
* <pre>

View File

@ -124,7 +124,7 @@ public final class RememberMeConfigurer<H extends HttpSecurityBuilder<H>> extend
* {@link UserDetails} when a remember me token is valid. The default is to
* use the {@link UserDetailsService} found by invoking
* {@link HttpSecurity#getSharedObject(Class)} which is set when using
* {@link WebSecurityConfigurerAdapter#registerAuthentication(org.springframework.security.config.annotation.authentication.AuthenticationManagerBuilder)}.
* {@link WebSecurityConfigurerAdapter#configure(AuthenticationManagerBuilder)}.
* Alternatively, one can populate {@link #rememberMeServices(RememberMeServices)}.
*
* @param userDetailsService

View File

@ -75,7 +75,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
* }
*
* &#064;Override
* protected void registerAuthentication(
* protected void configure(AuthenticationManagerBuilder auth)(
* AuthenticationManagerBuilder auth) throws Exception {
* auth
* .inMemoryAuthentication()

View File

@ -47,7 +47,7 @@ class AuthenticationManagerBuilderTests extends BaseSpringSpec {
}
// https://github.com/SpringSource/spring-security-javaconfig/issues/132
def "#132 Custom AuthenticationEventPublisher with Web registerAuthentication"() {
def "#132 Custom AuthenticationEventPublisher with Web configure(AuthenticationManagerBuilder)"() {
setup:
AuthenticationEventPublisher aep = Mock()
when:
@ -78,7 +78,7 @@ class AuthenticationManagerBuilderTests extends BaseSpringSpec {
@EnableWebSecurity
@Configuration
static class MultiAuthenticationProvidersConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()

View File

@ -35,8 +35,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
@Configuration
class BaseAuthenticationConfig {
@Autowired
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()

View File

@ -47,7 +47,7 @@ class NamespaceAuthenticationManagerTests extends BaseSpringSpec {
@EnableWebSecurity
@Configuration
static class EraseCredentialsTrueDefaultConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -74,7 +74,7 @@ class NamespaceAuthenticationManagerTests extends BaseSpringSpec {
@EnableWebSecurity
@Configuration
static class EraseCredentialsFalseConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.eraseCredentials(false)
.inMemoryAuthentication()

View File

@ -42,7 +42,7 @@ class NamespaceAuthenticationProviderTests extends BaseSpringSpec {
@Configuration
static class AuthenticationProviderRefConfig extends WebSecurityConfigurerAdapter {
static DaoAuthenticationProvider expected = new DaoAuthenticationProvider()
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.authenticationProvider(expected)
}
@ -67,7 +67,7 @@ class NamespaceAuthenticationProviderTests extends BaseSpringSpec {
@Configuration
static class UserServiceRefConfig extends WebSecurityConfigurerAdapter {
static InMemoryUserDetailsManager expected = new InMemoryUserDetailsManager([] as Collection)
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(expected)
}

View File

@ -54,7 +54,7 @@ class NamespaceJdbcUserServiceTests extends BaseSpringSpec {
@Autowired
private DataSource dataSource;
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.jdbcAuthentication()
.dataSource(dataSource) // jdbc-user-service@data-source-ref
@ -84,7 +84,7 @@ class NamespaceJdbcUserServiceTests extends BaseSpringSpec {
@Autowired
private DataSource dataSource;
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.jdbcAuthentication()
.dataSource(dataSource)
@ -132,7 +132,7 @@ class NamespaceJdbcUserServiceTests extends BaseSpringSpec {
@Autowired
private DataSource dataSource;
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.jdbcAuthentication()
// jdbc-user-service@dataSource

View File

@ -54,8 +54,7 @@ class NamespacePasswordEncoderTests extends BaseSpringSpec {
@Configuration
static class PasswordEncoderWithInMemoryConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder()
auth
@ -76,8 +75,7 @@ class NamespacePasswordEncoderTests extends BaseSpringSpec {
@Configuration
static class PasswordEncoderWithJdbcConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder()
auth
@ -106,8 +104,7 @@ class NamespacePasswordEncoderTests extends BaseSpringSpec {
@Configuration
static class PasswordEncoderWithUserDetailsServiceConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder()
User user = new User("user",encoder.encode("password"), AuthorityUtils.createAuthorityList("ROLE_USER"))

View File

@ -37,8 +37,7 @@ public class PasswordEncoderConfigurerConfigs {
@EnableWebSecurity
@Configuration
static class PasswordEncoderConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
BCryptPasswordEncoder encoder = passwordEncoder();
auth
.inMemoryAuthentication()
@ -66,8 +65,7 @@ public class PasswordEncoderConfigurerConfigs {
@EnableWebSecurity
@Configuration
static class PasswordEncoderNoAuthManagerLoadsConfig extends WebSecurityConfigurerAdapter {
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
BCryptPasswordEncoder encoder = passwordEncoder();
auth
.inMemoryAuthentication()

View File

@ -69,8 +69,7 @@ public class GlobalMethodSecurityConfigurationTests extends BaseSpringSpec {
static AuthenticationSuccessEvent EVENT
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}
@ -101,8 +100,7 @@ public class GlobalMethodSecurityConfigurationTests extends BaseSpringSpec {
static AuthenticationTrustResolver TR
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}
@ -135,8 +133,7 @@ public class GlobalMethodSecurityConfigurationTests extends BaseSpringSpec {
static class ExpressionHandlerHasBeanResolverSetConfig extends GlobalMethodSecurityConfiguration {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}
@ -188,8 +185,7 @@ public class GlobalMethodSecurityConfigurationTests extends BaseSpringSpec {
static class MethodSecurityServiceConfig extends GlobalMethodSecurityConfiguration {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}
@ -225,8 +221,7 @@ public class GlobalMethodSecurityConfigurationTests extends BaseSpringSpec {
static PermissionEvaluator PE
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}
@ -255,8 +250,7 @@ public class GlobalMethodSecurityConfigurationTests extends BaseSpringSpec {
static PermissionEvaluator PE
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}

View File

@ -67,7 +67,7 @@ public class SampleEnableGlobalMethodSecurityTests extends BaseSpringSpec {
}
@Autowired
public void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()
@ -104,8 +104,7 @@ public class SampleEnableGlobalMethodSecurityTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()

View File

@ -91,7 +91,7 @@ public class SampleWebSecurityConfigurerAdapterTests extends BaseSpringSpec {
@EnableWebSecurity
public static class HelloWorldWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth) {
protected void configure(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
@ -179,7 +179,7 @@ public class SampleWebSecurityConfigurerAdapterTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth) {
protected void configure(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()
@ -276,7 +276,7 @@ public class SampleWebSecurityConfigurerAdapterTests extends BaseSpringSpec {
@EnableWebSecurity
public static class SampleMultiHttpSecurityConfig {
@Autowired
public void registerAuthentication(AuthenticationManagerBuilder auth) {
protected void configure(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()

View File

@ -89,8 +89,7 @@ class WebSecurityConfigurerAdapterTests extends BaseSpringSpec {
static class HeadersArePopulatedByDefaultConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -114,8 +113,7 @@ class WebSecurityConfigurerAdapterTests extends BaseSpringSpec {
static class WebAsyncPopulatedByDefaultConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -127,7 +125,7 @@ class WebSecurityConfigurerAdapterTests extends BaseSpringSpec {
}
}
def "AuthenticationEventPublisher is registered for Web registerAuthentication"() {
def "AuthenticationEventPublisher is registered for Web configure(AuthenticationManagerBuilder auth)"() {
when:
loadConfig(InMemoryAuthWithWebSecurityConfigurerAdapter)
then:
@ -152,8 +150,7 @@ class WebSecurityConfigurerAdapterTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -236,8 +233,7 @@ class WebSecurityConfigurerAdapterTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")

View File

@ -61,8 +61,7 @@ public class WebSecurityConfigurerAdapterTestsConfigs {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication().and()
.jdbcAuthentication()

View File

@ -32,8 +32,7 @@ public abstract class BaseWebConfig extends WebSecurityConfigurerAdapter {
BaseWebConfig() {
}
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()

View File

@ -45,8 +45,7 @@ class EnableWebSecurityTests extends BaseSpringSpec {
@Configuration
static class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");

View File

@ -186,8 +186,7 @@ class CsrfConfigurerTests extends BaseSpringSpec {
.csrfTokenRepository(repo)
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -342,8 +341,7 @@ class CsrfConfigurerTests extends BaseSpringSpec {
.csrfTokenRepository(repo)
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")

View File

@ -99,8 +99,7 @@ class ExceptionHandlingConfigurerTests extends BaseSpringSpec {
static class HttpBasicAndFormLoginEntryPointsConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")

View File

@ -277,8 +277,7 @@ public class ExpressionUrlAuthorizationConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -374,8 +373,7 @@ public class ExpressionUrlAuthorizationConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -418,8 +416,7 @@ public class ExpressionUrlAuthorizationConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -451,8 +448,7 @@ public class ExpressionUrlAuthorizationConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}

View File

@ -70,8 +70,7 @@ class HttpBasicConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}
@ -99,8 +98,7 @@ class HttpBasicConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}
@ -130,8 +128,7 @@ class HttpBasicConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}

View File

@ -160,8 +160,7 @@ public class NamespaceHttpInterceptUrlTests extends BaseSpringSpec {
// <intercept-url pattern="/**" requires-channel="http"/>
.anyRequest().requiresInsecure()
}
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()

View File

@ -99,8 +99,7 @@ public class NamespaceHttpPortMappingsTests extends BaseSpringSpec {
.anyRequest().requiresInsecure()
}
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()

View File

@ -82,7 +82,7 @@ public class NamespaceHttpX509Tests extends BaseSpringSpec {
@EnableWebSecurity
public static class X509Config extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.
inMemoryAuthentication()
.withUser("rod").password("password").roles("USER","ADMIN");
@ -116,7 +116,7 @@ public class NamespaceHttpX509Tests extends BaseSpringSpec {
public static class AuthenticationDetailsSourceRefConfig extends WebSecurityConfigurerAdapter {
static AuthenticationDetailsSource<HttpServletRequest, PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails> AUTHENTICATION_DETAILS_SOURCE
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.
inMemoryAuthentication()
.withUser("rod").password("password").roles("USER","ADMIN");
@ -148,7 +148,7 @@ public class NamespaceHttpX509Tests extends BaseSpringSpec {
@EnableWebSecurity
public static class SubjectPrincipalRegexConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.
inMemoryAuthentication()
.withUser("rod").password("password").roles("USER","ADMIN");
@ -181,7 +181,7 @@ public class NamespaceHttpX509Tests extends BaseSpringSpec {
@EnableWebSecurity
public static class UserDetailsServiceRefConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.
inMemoryAuthentication()
.withUser("rod").password("password").roles("USER","ADMIN");
@ -215,7 +215,7 @@ public class NamespaceHttpX509Tests extends BaseSpringSpec {
public static class AuthenticationUserDetailsServiceConfig extends WebSecurityConfigurerAdapter {
static AuthenticationDetailsSource<HttpServletRequest, PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails> AUTHENTICATION_DETAILS_SOURCE
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.
inMemoryAuthentication()
.withUser("rod").password("password").roles("USER","ADMIN");

View File

@ -303,8 +303,7 @@ public class NamespaceRememberMeTests extends BaseSpringSpec {
.rememberMe()
}
protected void registerAuthentication(
AuthenticationManagerBuilder auth) throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(USERDETAILS_SERVICE);
}

View File

@ -55,8 +55,7 @@ class PermitAllSupportTests extends BaseSpringSpec {
static class NoAuthorizedUrlsConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}

View File

@ -73,8 +73,7 @@ public class RememberMeConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
User user = new User("user", "password", AuthorityUtils.createAuthorityList("ROLE_USER"))
DaoAuthenticationProvider provider = new DaoAuthenticationProvider()
provider.userDetailsService = new InMemoryUserDetailsManager([user])
@ -173,7 +172,7 @@ public class RememberMeConfigurerTests extends BaseSpringSpec {
}
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) {
public void configureGlobal(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");

View File

@ -174,8 +174,7 @@ class RequestCacheConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")

View File

@ -70,8 +70,7 @@ class ServletApiConfigurerTests extends BaseSpringSpec {
static class ServletApiConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -102,8 +101,7 @@ class ServletApiConfigurerTests extends BaseSpringSpec {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")

View File

@ -144,7 +144,7 @@ class SessionManagementConfigurerTests extends BaseSpringSpec {
.maximumSessions(1)
}
@Override
public void registerAuthentication(AuthenticationManagerBuilder auth) {
protected void configure(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
@ -188,7 +188,7 @@ class SessionManagementConfigurerTests extends BaseSpringSpec {
.maxSessionsPreventsLogin(true)
}
@Override
public void registerAuthentication(AuthenticationManagerBuilder auth) {
protected void configure(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")

View File

@ -67,8 +67,7 @@ class OpenIDLoginConfigurerTests extends BaseSpringSpec {
static class InvokeTwiceDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
}

View File

@ -121,8 +121,7 @@ public class SessionManagementConfigurerServlet31Tests {
}
@Override
protected void registerAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");

View File

@ -74,7 +74,7 @@ import org.springframework.security.config.annotation.web.configuration.*;
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception {
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");

View File

@ -290,7 +290,7 @@ import org.springframework.security.config.annotation.web.configuration.*;
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception {
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
@ -517,7 +517,7 @@ We have already seen an example of configuring in memory authentication for a si
[source,java]
----
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception {
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()
@ -535,7 +535,7 @@ You can find the updates to suppport JDBC based authentication. The example belo
private DataSource dataSource;
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception {
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.jdbcAuthentication()
.dataSource(dataSource)
@ -555,7 +555,7 @@ You can find the updates to suppport LDAP based authentication. The https://gith
private DataSource dataSource;
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception {
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("uid={0},ou=people")

View File

@ -10,7 +10,7 @@ import org.springframework.security.config.annotation.web.configuration.*;
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception {
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");

View File

@ -17,7 +17,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
private DataSource dataSource;
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception {
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.jdbcAuthentication()
.dataSource(dataSource)

View File

@ -12,7 +12,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void registerGlobalAuthentication(AuthenticationManagerBuilder auth)
public void configureGlobal(AuthenticationManagerBuilder auth)
throws Exception {
auth.
inMemoryAuthentication()