SEC-702: Updated use of UsernameNotFoundException to set extraInformation property
This commit is contained in:
parent
712f1770d9
commit
5d6ec8ed71
|
@ -119,7 +119,7 @@ public class FilterBasedLdapUserSearch implements LdapUserSearch {
|
|||
|
||||
} catch (IncorrectResultSizeDataAccessException notFound) {
|
||||
if (notFound.getActualSize() == 0) {
|
||||
throw new UsernameNotFoundException("User " + username + " not found in directory.");
|
||||
throw new UsernameNotFoundException("User " + username + " not found in directory.", username);
|
||||
}
|
||||
// Search should never return multiple results if properly configured, so just rethrow
|
||||
throw notFound;
|
||||
|
|
|
@ -89,7 +89,7 @@ public final class PasswordComparisonAuthenticator extends AbstractLdapAuthentic
|
|||
}
|
||||
|
||||
if (user == null) {
|
||||
throw new UsernameNotFoundException(username);
|
||||
throw new UsernameNotFoundException("User not found: " + username, username);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
|
|
@ -148,7 +148,7 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService {
|
|||
|
||||
if (users.size() == 0) {
|
||||
throw new UsernameNotFoundException(
|
||||
messages.getMessage("JdbcDaoImpl.notFound", new Object[]{username}, "Username {0} not found"));
|
||||
messages.getMessage("JdbcDaoImpl.notFound", new Object[]{username}, "Username {0} not found"), username);
|
||||
}
|
||||
|
||||
UserDetails user = (UserDetails) users.get(0); // contains no GrantedAuthority[]
|
||||
|
@ -170,7 +170,7 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService {
|
|||
if (dbAuths.size() == 0) {
|
||||
throw new UsernameNotFoundException(
|
||||
messages.getMessage("JdbcDaoImpl.noAuthority",
|
||||
new Object[] {username}, "User {0} has no GrantedAuthority"));
|
||||
new Object[] {username}, "User {0} has no GrantedAuthority"), username);
|
||||
}
|
||||
|
||||
GrantedAuthority[] arrayAuths = (GrantedAuthority[]) dbAuths.toArray(new GrantedAuthority[dbAuths.size()]);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class UserMap {
|
|||
UserDetails result = (UserDetails) this.userMap.get(username.toLowerCase());
|
||||
|
||||
if (result == null) {
|
||||
throw new UsernameNotFoundException("Could not find user: " + username);
|
||||
throw new UsernameNotFoundException("Could not find user: " + username, username);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue