Package idatt2106.group3.backend.Service
Class UserSecurityDetailsService
- java.lang.Object
-
- idatt2106.group3.backend.Service.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
-
-
Constructor Summary
Constructors Constructor Description UserSecurityDetailsService()
-
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.
-
-
-
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 interfaceorg.springframework.security.core.userdetails.UserDetailsService
- Parameters:
email
-- Returns:
- UserDetails
- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-
-