mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-12 07:02:13 +00:00
SEC-1493: Fix broken tests in 3.0.x branch
This commit is contained in:
parent
21a664b2eb
commit
02c1f02f2a
@ -54,17 +54,17 @@ public class AuthenticationManagerBeanDefinitionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void credentialsAreClearedByDefault() throws Exception {
|
||||
setContext(CONTEXT, "3.1");
|
||||
public void credentialsAreNotClearedByDefault() throws Exception {
|
||||
setContext(CONTEXT, "3.0");
|
||||
ProviderManager pm = (ProviderManager) appContext.getBeansOfType(ProviderManager.class).values().toArray()[0];
|
||||
assertTrue(pm.isEraseCredentialsAfterAuthentication());
|
||||
assertFalse(pm.isEraseCredentialsAfterAuthentication());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearCredentialsPropertyIsRespected() throws Exception {
|
||||
setContext("<authentication-manager erase-credentials='false'/>", "3.1");
|
||||
setContext("<authentication-manager erase-credentials='true'/>", "3.0.3");
|
||||
ProviderManager pm = (ProviderManager) appContext.getBeansOfType(ProviderManager.class).values().toArray()[0];
|
||||
assertFalse(pm.isEraseCredentialsAfterAuthentication());
|
||||
assertTrue(pm.isEraseCredentialsAfterAuthentication());
|
||||
}
|
||||
|
||||
private void setContext(String context, String version) {
|
||||
|
@ -54,16 +54,16 @@ public class ProviderManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void credentialsAreClearedByDefault() throws Exception {
|
||||
public void credentialsAreNotClearedByDefault() throws Exception {
|
||||
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken("Test", "Password");
|
||||
ProviderManager mgr = makeProviderManager();
|
||||
Authentication result = mgr.authenticate(token);
|
||||
assertNull(result.getCredentials());
|
||||
assertNotNull(result.getCredentials());
|
||||
|
||||
mgr.setEraseCredentialsAfterAuthentication(false);
|
||||
mgr.setEraseCredentialsAfterAuthentication(true);
|
||||
token = new UsernamePasswordAuthenticationToken("Test", "Password");
|
||||
result = mgr.authenticate(token);
|
||||
assertNotNull(result.getCredentials());
|
||||
assertNull(result.getCredentials());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user