Class UserServiceFacade
java.lang.Object
org.eco.mubisoft.good_and_cheap.user.domain.service.UserServiceFacade
- All Implemented Interfaces:
UserService
,org.springframework.security.core.userdetails.UserDetailsService
@Service public class UserServiceFacade extends java.lang.Object implements UserService, org.springframework.security.core.userdetails.UserDetailsService
-
Field Summary
Fields Modifier and Type Field Description private LocationRepository
locationRepo
private org.springframework.security.crypto.password.PasswordEncoder
passwordEncoder
private UserRepository
userRepo
-
Constructor Summary
Constructors Constructor Description UserServiceFacade()
-
Method Summary
Modifier and Type Method Description AppUser
deleteUser(AppUser user)
DELETE USERAppUser
getUser(java.lang.Long id)
GET USER BY IDAppUser
getUser(java.lang.String username)
GET USER BY USERNAMEorg.springframework.security.core.userdetails.UserDetails
loadUserByUsername(java.lang.String username)
AppUser
saveUser(AppUser user)
SAVE USERMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
userRepo
-
locationRepo
-
passwordEncoder
private final org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
-
-
Constructor Details
-
UserServiceFacade
public UserServiceFacade()
-
-
Method Details
-
saveUser
Description copied from interface:UserService
SAVE USER
Save a user on the database. It makes sure if the user's email is unique on the database. If the email is already taken or any other error is detected, the user won't be created.
- Specified by:
saveUser
in interfaceUserService
- Parameters:
user
- The user that is going to be added.- Returns:
- The user that has been added on the database, with an encrypted password.
-
getUser
Description copied from interface:UserService
GET USER BY ID
Get a user form the database using it's user ID.
- Specified by:
getUser
in interfaceUserService
- Parameters:
id
- The ID of the user that is going to be searched.- Returns:
- The user from the database.
-
getUser
Description copied from interface:UserService
GET USER BY USERNAME
Get a user form the database using its email.
- Specified by:
getUser
in interfaceUserService
- Parameters:
username
- The email of the user that is going to be searched.- Returns:
- The user from the database.
-
deleteUser
Description copied from interface:UserService
DELETE USER
Remove a user from the database. If the user doesn't exist won't it return anything.
- Specified by:
deleteUser
in interfaceUserService
- Parameters:
user
- The user that is going to be removed.- Returns:
- The user that has been removed from the database.
-
loadUserByUsername
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(java.lang.String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException- Specified by:
loadUserByUsername
in interfaceorg.springframework.security.core.userdetails.UserDetailsService
- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-