Fix issue when encoded passwords are used. Modify Contacts sample to test encoded passwords.
This commit is contained in:
@@ -194,8 +194,10 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure we return the original credentials the user supplied,
|
||||
// so subsequent attempts are successful even with encoded passwords
|
||||
return new UsernamePasswordAuthenticationToken(user.getUsername(),
|
||||
user.getPassword(), user.getAuthorities());
|
||||
authentication.getCredentials(), user.getAuthorities());
|
||||
}
|
||||
|
||||
public boolean supports(Class authentication) {
|
||||
|
||||
+3
-1
@@ -193,7 +193,9 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
||||
|
||||
UsernamePasswordAuthenticationToken castResult = (UsernamePasswordAuthenticationToken) result;
|
||||
assertEquals("marissa", castResult.getPrincipal());
|
||||
assertEquals("koala{SYSTEM_SALT_VALUE}", castResult.getCredentials());
|
||||
|
||||
// We expect original credentials user submitted to be returned
|
||||
assertEquals("koala", castResult.getCredentials());
|
||||
assertEquals("ROLE_ONE", castResult.getAuthorities()[0].getAuthority());
|
||||
assertEquals("ROLE_TWO", castResult.getAuthorities()[1].getAuthority());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user