Class 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
    • Constructor Detail

      • UserRoleDaoUserDetailsService

        public UserRoleDaoUserDetailsService()
    • 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 interface org.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 the User.
        Parameters:
        username - the username, for use by finder methods
        authorities - the current granted authorities, as populated from the authoritiesByUsername 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 the 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.
        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.