Package api.mpba.rastvdmy.controller
Class AuthController
java.lang.Object
api.mpba.rastvdmy.controller.AuthController
Controller for handling authentication-related requests such as user signup and login.
This controller exposes endpoints for user registration and authentication,
leveraging the AuthService
to manage the underlying authentication logic.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<JwtAuthResponse> authenticate
(@Valid UserLoginRequest userLoginRequest) Endpoint for user login.org.springframework.http.ResponseEntity
<JwtAuthResponse> signUp
(@Valid UserProfileRequest request) Endpoint for user signup.
-
Constructor Details
-
AuthController
Constructor for AuthController.- Parameters:
authService
- TheAuthService
to be used.
-
-
Method Details
-
signUp
@PostMapping(path="/signup", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<JwtAuthResponse> signUp(@Valid @RequestBody @Valid UserProfileRequest request) throws Exception Endpoint for user signup.- Parameters:
request
- TheUserProfileRequest
containing user details for signup.- Returns:
- A
ResponseEntity
containing the JWT authentication response. - Throws:
Exception
- If there is an error during signup.
-
authenticate
@PostMapping(path="/login", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<JwtAuthResponse> authenticate(@Valid @RequestBody @Valid UserLoginRequest userLoginRequest) Endpoint for user login.- Parameters:
userLoginRequest
- TheUserLoginRequest
containing user credentials.- Returns:
- A
ResponseEntity
containing the JWT authentication response.
-