1
0
mirror of synced 2026-08-05 01:36:56 +00:00

Fix issue when encoded passwords are used. Modify Contacts sample to test encoded passwords.

This commit is contained in:
Ben Alex
2004-06-08 12:54:42 +00:00
parent b9b176da82
commit b3e2d78c5d
3 changed files with 19 additions and 7 deletions
@@ -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) {
@@ -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());
}