Skip to content

Commit 722b943

Browse files
authored
Update README.md
1 parent a9496b6 commit 722b943

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

Diff for: β€ŽREADME.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
# spring-security-ott
1+
## πŸ”Ή How Spring Security Validates the OTT?
2+
3+
Spring Security has a built-in filter and authentication provider to handle **One-Time Token (OTT)** validation.
4+
5+
### πŸ”— Request to `/login/ott?token=XYZ`
6+
1. The user clicks on the **magic link** or enters the **token manually**.
7+
2. The request is sent to `/login/ott` with the **token** as a query parameter.
8+
9+
### πŸ›‘οΈ Spring Security Intercepts the Request
10+
- `OneTimeTokenAuthenticationFilter` (part of Spring Security) **intercepts the request**.
11+
- It **extracts** the token value from the request (`token=XYZ`).
12+
13+
### πŸ”„ Delegates to Authentication Manager
14+
- Spring Security **delegates** the token to `OneTimeTokenAuthenticationProvider`.
15+
16+
### βœ… Token Validation Process
17+
βœ” **Checks if the token exists** in the database or token storage.
18+
βœ” **Validates token expiry** (time-limited).
19+
βœ” **Verifies token association** with the correct user.
20+
21+
### πŸ”“ Authentication Success or Failure
22+
βœ… **If valid** β†’ Spring Security **authenticates** the user and starts a session.
23+
❌ **If invalid/expired** β†’ Returns an **authentication error (401 Unauthorized)**.
24+
25+
---
26+
27+
This structure makes it **clear, professional, and easy to read** for GitHub users. Let me know if you need any changes! πŸš€

0 commit comments

Comments
Β (0)