Class CustomUserDetailsService

  • All Implemented Interfaces:
    org.springframework.security.core.userdetails.UserDetailsService

    @Service("userDetailsService")
    public class CustomUserDetailsService
    extends java.lang.Object
    implements org.springframework.security.core.userdetails.UserDetailsService
    The custom user details service which fetches the account and their roles from the database from the authentication session information
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.security.core.userdetails.UserDetails loadUserByUsername​(java.lang.String email)
      Searches for the account using the email, loads the roles associated to that account.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CustomUserDetailsService

        public CustomUserDetailsService()
    • Method Detail

      • loadUserByUsername

        public org.springframework.security.core.userdetails.UserDetails loadUserByUsername​(java.lang.String email)
                                                                                     throws org.springframework.security.core.userdetails.UsernameNotFoundException
        Searches for the account using the email, loads the roles associated to that account. It then creates a "user" object using the email, encoded password and roles for the authentication manager
        Specified by:
        loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsService
        Parameters:
        email - the email of the user to find
        Returns:
        the new "user" object
        Throws:
        org.springframework.security.core.userdetails.UsernameNotFoundException - if the email was not found in the database