Package com.ericbouchut.learndev.auth
Class EmailVerificationController
java.lang.Object
com.ericbouchut.learndev.auth.EmailVerificationController
Web endpoints of the email verification flow: the emailed link
lands on
GET /auth/verify (public, like the whole /auth
prefix), and a logged-in user can ask for a fresh link from the dashboard
banner. The outcome is carried by query flags on the redirect targets,
following the house PRG idiom.-
Constructor Summary
ConstructorsConstructorDescriptionEmailVerificationController(EmailVerificationService verification, UserRepository users) -
Method Summary
Modifier and TypeMethodDescriptionSend a fresh verification link to the logged-in user (dashboard banner action).Consume the emailed verification link.
-
Constructor Details
-
EmailVerificationController
-
-
Method Details
-
verify
@GetMapping("/auth/verify") public String verify(@RequestParam String token, jakarta.servlet.http.HttpServletRequest request) Consume the emailed verification link.- Parameters:
token- the raw token from the linkrequest- provides the client IP for the audit trail- Returns:
- a redirect to the login page with a verified or invalid flag
-
resend
@PostMapping("/auth/verify/resend") public String resend(Principal principal, jakarta.servlet.http.HttpServletRequest request) Send a fresh verification link to the logged-in user (dashboard banner action).- Parameters:
principal- the logged-in user, or null when the session expiredrequest- provides the client IP and the absolute verify URL- Returns:
- a redirect to the dashboard with a confirmation flag
-