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
A
UserDetailsService
that delegates to an IUserRoleDao
to load users by username.- Author:
- mlowery
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
A data access exception specific to aIUserRoleDao
-basedUserDetailsService
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCustomAuthorities
(String username, List authorities) Allows subclasses to add their own granted authorities to the list to be returned in theUser
.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)
-
Constructor Details
-
UserRoleDaoUserDetailsService
public UserRoleDaoUserDetailsService()
-
-
Method Details
-
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
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
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
-
setUserRoleDao
public void setUserRoleDao(org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao userRoleDao) -
setDefaultRole
The default role which will be assigned to all users.- Parameters:
defaultRole
- the role name, including any desired prefix.
-