public class UserRoleDaoUserDetailsService extends Object implements org.springframework.security.core.userdetails.UserDetailsService
UserDetailsService
that delegates to an IUserRoleDao
to load users by username.Modifier and Type | Class and Description |
---|---|
protected class |
UserRoleDaoUserDetailsService.UserRoleDaoUserDetailsServiceException
A data access exception specific to a
IUserRoleDao -based UserDetailsService . |
Constructor and Description |
---|
UserRoleDaoUserDetailsService() |
Modifier and Type | Method and Description |
---|---|
protected void |
addCustomAuthorities(String username,
List authorities)
Allows subclasses to add their own granted authorities to the list to be returned in the
User . |
String |
getRolePrefix() |
org.springframework.security.core.userdetails.UserDetails |
loadUserByUsername(String username) |
void |
setDefaultRole(String defaultRole)
The default role which will be assigned to all users.
|
void |
setRolePrefix(String rolePrefix)
Allows a default role prefix to be specified.
|
void |
setUserRoleDao(IUserRoleDao userRoleDao) |
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException, org.springframework.dao.DataAccessException
loadUserByUsername
in interface org.springframework.security.core.userdetails.UserDetailsService
org.springframework.security.core.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException
protected void addCustomAuthorities(String username, List authorities)
User
.username
- the username, for use by finder methodsauthorities
- the current granted authorities, as populated from the authoritiesByUsername
mappingpublic void setRolePrefix(String rolePrefix)
ROLE_
prefix
expected to exist in role names (by default) by some other Spring Security framework classes, in the case that
the prefix is not already present in the db.rolePrefix
- the new prefixpublic String getRolePrefix()
public void setUserRoleDao(IUserRoleDao userRoleDao)
public void setDefaultRole(String defaultRole)
defaultRole
- the role name, including any desired prefix.Copyright © 2017 Hitachi Vantara. All rights reserved.