Class AuthController
java.lang.Object
org.example.crmedu.application.controller.AuthController
REST controller for managing authentication operations. Provides endpoints to registration, login, verification and getting new tokens.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<JwtResponse> getNewAccessToken
(@Valid RefreshJwtRequest request) Updates access token and retrieves it.org.springframework.http.ResponseEntity
<JwtResponse> getNewRefreshToken
(@Valid RefreshJwtRequest request) Updates refresh and access token and retrieves it.org.springframework.http.ResponseEntity
<JwtResponse> login
(@Valid SignInRequest signInRequest) Sign in user.org.springframework.http.ResponseEntity
<SignUpResponse> signUp
(@Valid SignUpRequest signUpRequest) Sign up new user in system.org.springframework.http.ResponseEntity
<String> verifyEmail
(String token) Verifies user via verification token.
-
Constructor Details
-
AuthController
public AuthController()
-
-
Method Details
-
signUp
@PostMapping("/signup") public org.springframework.http.ResponseEntity<SignUpResponse> signUp(@Valid @RequestBody @Valid SignUpRequest signUpRequest) Sign up new user in system.- Parameters:
signUpRequest
- an object containing registration details- Returns:
- a
ResponseEntity
containing the registration data inSignUpResponse
-
verifyEmail
@GetMapping("/verify-email") public org.springframework.http.ResponseEntity<String> verifyEmail(@RequestParam String token) Verifies user via verification token.- Parameters:
token
- verification token of the user- Returns:
- a
ResponseEntity
that send text "verify", if user was verified successfully
-
login
@PostMapping("/login") public org.springframework.http.ResponseEntity<JwtResponse> login(@Valid @RequestBody @Valid SignInRequest signInRequest) Sign in user.- Parameters:
signInRequest
- an object containing sign in details- Returns:
- a
ResponseEntity
containing the tokens data inJwtResponse
-
getNewAccessToken
@PostMapping("/token") public org.springframework.http.ResponseEntity<JwtResponse> getNewAccessToken(@Valid @RequestBody @Valid RefreshJwtRequest request) Updates access token and retrieves it.- Parameters:
request
- an object containing details about refresh token- Returns:
- a
ResponseEntity
containing the tokens data inJwtResponse
-
getNewRefreshToken
@PostMapping("/refresh") public org.springframework.http.ResponseEntity<JwtResponse> getNewRefreshToken(@Valid @RequestBody @Valid RefreshJwtRequest request) Updates refresh and access token and retrieves it.- Parameters:
request
- an object containing details about refresh token- Returns:
- a
ResponseEntity
containing the tokens data inJwtResponse
-