Package com.mindstore.backend.service
Class AuthenticationService
java.lang.Object
com.mindstore.backend.service.AuthenticationService
Service class for authentication functions
-
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationService(UserRepository userRepository, org.springframework.security.authentication.AuthenticationManager authenticationManager, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) Authentication Service class -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(LoginUserDto input) function: used to authenticate a user, for example for the login by using authenticationManagerfindOrCreateUserByEmail(String email) function: search for a user by using the email if the user isn't found, create them.signup(RegisterUserDto input) function: sign up a user
-
Constructor Details
-
AuthenticationService
public AuthenticationService(UserRepository userRepository, org.springframework.security.authentication.AuthenticationManager authenticationManager, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) Authentication Service class- Parameters:
userRepository- containing user functionalities, eg. for signupauthenticationManager- manages authentication for the userpasswordEncoder- encodes the user password
-
-
Method Details
-
signup
function: sign up a user- Parameters:
input- RegisterUSerDTO with name and password- Returns:
- the saved User
-
authenticate
function: used to authenticate a user, for example for the login by using authenticationManager- Parameters:
input- LoginUserDto- Returns:
- User
-
findOrCreateUserByEmail
function: search for a user by using the email if the user isn't found, create them.- Parameters:
email- of the user- Returns:
- the User that was created
-