Package restapi.controllers
Class UsersControllerPublic
java.lang.Object
restapi.controllers.UsersControllerPublic
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull UserAuthenticationService
private final @NonNull FirebaseService
private final @NonNull UserRepository
private final @NonNull UserService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<RestResponse>
Common function to internally make the loginorg.springframework.http.ResponseEntity<RestResponse>
loginEmail
(String email, String password) Login with email and password.org.springframework.http.ResponseEntity<RestResponse>
loginPhone
(String phone, String password) Login with phone and password.org.springframework.http.ResponseEntity<RestResponse>
loginToken
(String authUID) Login after verifying phone with Firebase.org.springframework.http.ResponseEntity<RestResponse>
loginUsername
(String username, String password) Login with username and password.org.springframework.http.ResponseEntity<RestResponse>
Creates a user, logs in, and returns access token.
-
Field Details
-
authentication
-
userRepository
-
userService
-
authService
-
-
Constructor Details
-
UsersControllerPublic
UsersControllerPublic()
-
-
Method Details
-
signup
@PostMapping("/signup") public org.springframework.http.ResponseEntity<RestResponse> signup(@RequestParam("username") String username, @RequestParam("password") String password, @Param("authUID") String authUID, @Param("email") String email, @Param("country") String country) Creates a user, logs in, and returns access token. endpoint /public/users/signup- Parameters:
username
- Username must be uniquepassword
- Username must be uniqueauthUID
- Firebase authUID corresponding to a user logged with phoneemail
- Email must be uniquecountry
- Country code. ex: "ES"- Returns:
- Authentication Token
-
loginToken
@PostMapping("/logintoken") public org.springframework.http.ResponseEntity<RestResponse> loginToken(@RequestParam("authUID") String authUID) Login after verifying phone with Firebase. Returns Token. endpoint /public/users/logintoken- Parameters:
authUID
- Firebase authUID corresponding to a user logged with phone- Returns:
- Authentication Token
-
loginUsername
@PostMapping("/login") public org.springframework.http.ResponseEntity<RestResponse> loginUsername(@RequestParam("username") String username, @RequestParam("password") String password) Login with username and password. Returns Token. endpoint /public/users/login- Parameters:
username
- user's idpassword
- Password must match with the one on the database- Returns:
- Authentication Token
-
loginEmail
@PostMapping("/loginemail") public org.springframework.http.ResponseEntity<RestResponse> loginEmail(@RequestParam("email") String email, @RequestParam("password") String password) Login with email and password. Returns Token. endpoint /public/users/loginemail- Parameters:
email
- user's idpassword
- Password must match with the one on the database- Returns:
- Authentication Token
-
loginPhone
@PostMapping("/loginphone") public org.springframework.http.ResponseEntity<RestResponse> loginPhone(@RequestParam("phone") String phone, @RequestParam("password") String password) Login with phone and password. Returns Token. endpoint /public/users- Parameters:
phone
- user's idpassword
- Password must match with the one on the database- Returns:
- Authentication Token
-
login
public org.springframework.http.ResponseEntity<RestResponse> login(String username, String password) Common function to internally make the login- Parameters:
username
- username idpassword
- Password must match with the one on the database- Returns:
- Authentication Token
-