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
Nested ClassesModifier and TypeClassDescriptionprotected classA data access exception specific to aIUserRoleDao-basedUserDetailsService. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomAuthorities(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.UserDetailsloadUserByUsername(String username) voidsetDefaultRole(String defaultRole) The default role which will be assigned to all users.voidsetRolePrefix(String rolePrefix) Allows a default role prefix to be specified.voidsetUserRoleDao(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:
loadUserByUsernamein interfaceorg.springframework.security.core.userdetails.UserDetailsService- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundExceptionorg.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 theauthoritiesByUsernamemapping
-
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.
-