Klasse AuthController
java.lang.Object
com.spaghetticodegang.trylater.auth.AuthController
REST controller providing endpoints for authentication management.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungorg.springframework.http.ResponseEntity
<UserMeResponseDto> login
(@Valid AuthRequestDto authRequestDto, jakarta.servlet.http.HttpServletResponse response) Handles the user login request by delegating to the service layer.org.springframework.http.ResponseEntity
<Void> Logs the user out by clearing the authentication cookie.
-
Konstruktordetails
-
AuthController
public AuthController()
-
-
Methodendetails
-
login
@PostMapping("/login") public org.springframework.http.ResponseEntity<UserMeResponseDto> login(@RequestBody @Valid @Valid AuthRequestDto authRequestDto, jakarta.servlet.http.HttpServletResponse response) Handles the user login request by delegating to the service layer.- Parameter:
authRequestDto
- the credentials provided by the userresponse
- the HTTP servlet response used to attach the auth cookie- Gibt zurück:
- the authenticated user's public information
-
logout
@PostMapping("/logout") public org.springframework.http.ResponseEntity<Void> logout(@AuthenticationPrincipal User user, jakarta.servlet.http.HttpServletResponse response) Logs the user out by clearing the authentication cookie.- Parameter:
user
- the currently authenticated user (automatically injected)response
- the HTTP servlet response used to remove the auth cookie- Gibt zurück:
- a 204 No Content response
-