Class UserRoleDaoUserDetailsService
- java.lang.Object
-
- org.pentaho.platform.security.userroledao.service.UserRoleDaoUserDetailsService
-
- All Implemented Interfaces:
org.springframework.security.core.userdetails.UserDetailsService
public class UserRoleDaoUserDetailsService extends Object implements org.springframework.security.core.userdetails.UserDetailsService
AUserDetailsService
that delegates to anIUserRoleDao
to load users by username.- Author:
- mlowery
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
UserRoleDaoUserDetailsService.UserRoleDaoUserDetailsServiceException
A data access exception specific to aIUserRoleDao
-basedUserDetailsService
.
-
Constructor Summary
Constructors Constructor Description UserRoleDaoUserDetailsService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCustomAuthorities(String username, List authorities)
Allows subclasses to add their own granted authorities to the list to be returned in theUser
.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(org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao userRoleDao)
-
-
-
Method Detail
-
loadUserByUsername
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException, org.springframework.dao.DataAccessException
- Specified by:
loadUserByUsername
in interfaceorg.springframework.security.core.userdetails.UserDetailsService
- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException
-
addCustomAuthorities
protected void addCustomAuthorities(String username, List authorities)
Allows subclasses to add their own granted authorities to the list to be returned in theUser
.- Parameters:
username
- the username, for use by finder methodsauthorities
- the current granted authorities, as populated from theauthoritiesByUsername
mapping
-
setRolePrefix
public void setRolePrefix(String rolePrefix)
Allows a default role prefix to be specified. If this is set to a non-empty value, then it is automatically prepended to any roles read in from the db. This may for example be used to add theROLE_
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.- Parameters:
rolePrefix
- the new prefix
-
getRolePrefix
public String getRolePrefix()
-
setUserRoleDao
public void setUserRoleDao(org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao userRoleDao)
-
setDefaultRole
public void setDefaultRole(String defaultRole)
The default role which will be assigned to all users.- Parameters:
defaultRole
- the role name, including any desired prefix.
-
-