mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-25 21:42:17 +00:00
Allow subclasses to add their own custom GrantedAuthority[]s.
This commit is contained in:
parent
943ffda937
commit
7ac3706eb9
@ -179,12 +179,25 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrantedAuthority[] arrayAuths = {};
|
GrantedAuthority[] arrayAuths = {};
|
||||||
|
|
||||||
|
addCustomAuthorities(user.getUsername(), dbAuths);
|
||||||
|
|
||||||
arrayAuths = (GrantedAuthority[]) dbAuths.toArray(arrayAuths);
|
arrayAuths = (GrantedAuthority[]) dbAuths.toArray(arrayAuths);
|
||||||
|
|
||||||
return new User(user.getUsername(), user.getPassword(),
|
return new User(user.getUsername(), user.getPassword(),
|
||||||
user.isEnabled(), arrayAuths);
|
user.isEnabled(), arrayAuths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows subclasses to add their own granted authorities to the list to be
|
||||||
|
* returned in the <code>User</code>.
|
||||||
|
*
|
||||||
|
* @param username the username, for use by finder methods
|
||||||
|
* @param authorities the current granted authorities, as populated from
|
||||||
|
* the <code>authoritiesByUsername</code> mapping
|
||||||
|
*/
|
||||||
|
protected void addCustomAuthorities(String username, List authorities) {}
|
||||||
|
|
||||||
protected void initDao() throws ApplicationContextException {
|
protected void initDao() throws ApplicationContextException {
|
||||||
initMappingSqlQueries();
|
initMappingSqlQueries();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user