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
AUserDetailsServicethat delegates to anIUserRoleDaoto load users by username.- Author:
- mlowery
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classUserRoleDaoUserDetailsService.UserRoleDaoUserDetailsServiceExceptionA 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 voidaddCustomAuthorities(String username, List authorities)Allows subclasses to add their own granted authorities to the list to be returned in theUser.StringgetRolePrefix()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)
-
-
-
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:
loadUserByUsernamein interfaceorg.springframework.security.core.userdetails.UserDetailsService- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundExceptionorg.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 theauthoritiesByUsernamemapping
-
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.
-
-