Class UserSecurityDetailsService

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

    @Service
    public class UserSecurityDetailsService
    extends java.lang.Object
    implements org.springframework.security.core.userdetails.UserDetailsService
    Service class needed for getting User from database and creating UserDetails object needed for Security Principal
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.security.core.userdetails.UserDetails loadUserByUsername​(java.lang.String email)
      Overrides the method from UserDetailsService interface.
      • Methods inherited from class java.lang.Object

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

      • UserSecurityDetailsService

        public UserSecurityDetailsService()
    • Method Detail

      • loadUserByUsername

        public org.springframework.security.core.userdetails.UserDetails loadUserByUsername​(java.lang.String email)
                                                                                     throws org.springframework.security.core.userdetails.UsernameNotFoundException
        Overrides the method from UserDetailsService interface. We use email as user's username in our case. Gets user with email from our MySQL database and creates an UserSecurityDetails object and returns its
        Specified by:
        loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsService
        Parameters:
        email -
        Returns:
        UserDetails
        Throws:
        org.springframework.security.core.userdetails.UsernameNotFoundException