Skip to content

Commit c097efd

Browse files
authored
Add documentation for logout flow in UltimateAuth
Document the logout flow and its distinctions in UltimateAuth, including session, device, and identity scopes.
1 parent ddcd7f3 commit c097efd

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# 🚪 Logout Flow
2+
The logout flow in UltimateAuth is not a single action.
3+
4+
👉 It represents different **levels of authentication termination**.
5+
6+
## 🧠 What is Logout?
7+
In traditional systems:
8+
9+
- Logout = remove cookie or token
10+
11+
In UltimateAuth:
12+
13+
👉 Logout affects **session, device, or identity scope**
14+
15+
> Logout is not just removing access
16+
> → It is controlling session lifecycle
17+
18+
## 🔀 Logout vs Revoke
19+
UltimateAuth distinguishes between two concepts:
20+
21+
### 🔹 Logout (Soft Termination)
22+
23+
- Ends the current session
24+
- Keeps the device (chain) active
25+
- Allows re-login without resetting device context
26+
27+
```
28+
Session → Invalidated
29+
Chain → Still Active
30+
```
31+
32+
👉 User can log in again and continue on the same device chain
33+
34+
### 🔥 Revoke (Hard Invalidation)
35+
- Invalidates session, chain, or root
36+
- Cannot be undone
37+
- Forces a completely new authentication path
38+
39+
```
40+
Chain → Revoked
41+
Sessions → Revoked
42+
Next login → New chain
43+
```
44+
45+
👉 Revoke resets trust for that scope
46+
47+
<br>
48+
49+
## 🧩 Levels of Termination
50+
UltimateAuth supports multiple logout scopes:
51+
52+
### 🔹 Session-Level Logout
53+
- Terminates a single session
54+
- Other sessions on the same device may remain
55+
56+
### 📱 Device-Level (Chain)
57+
- Terminates all sessions on a device
58+
- Device chain is invalidated or reset
59+
60+
### 🌐 Global Logout (All Devices)
61+
- Terminates all sessions across all devices
62+
- Keeps root (user identity) intact
63+
64+
### 🔥 Root Revoke
65+
- Invalidates entire authentication state
66+
- All chains and sessions are revoked
67+
68+
👉 This is the strongest possible action
69+
70+
<br>
71+
72+
## 🔄 Step-by-Step Execution
73+
74+
### 1️⃣ Flow Context Resolution
75+
The system resolves:
76+
77+
- Current session
78+
- User identity
79+
- Tenant
80+
81+
### 2️⃣ Authority Decision
82+
Logout operations are validated:
83+
84+
- Authorization checks
85+
- Access validation
86+
87+
👉 Logout is not blindly executed
88+
89+
### 3️⃣ Scope Determination
90+
The system determines what to terminate:
91+
92+
- Session
93+
- Chain
94+
- Root
95+
96+
### 4️⃣ Execution
97+
Depending on scope:
98+
99+
#### Session Logout
100+
- Session is revoked
101+
- Other sessions unaffected
102+
103+
#### Chain Revoke / Logout
104+
- All sessions in the chain are revoked
105+
- Device trust is reset
106+
107+
#### Global Logout
108+
- All chains are revoked (optionally excluding current)
109+
110+
#### Root Revoke
111+
- Entire identity state is invalidated
112+
113+
### 5️⃣ Event Dispatch
114+
The system emits:
115+
116+
- Logout events
117+
- Audit logs
118+
119+
<br>
120+
121+
## 📱 Device Awareness
122+
Logout behavior is device-aware:
123+
124+
- Each device is a chain
125+
- Logout can target specific devices
126+
- Sessions are grouped by device
127+
128+
👉 This enables fine-grained control
129+
130+
<br>
131+
132+
## 🔐 Security Model
133+
134+
### 🔒 Controlled Termination
135+
All logout operations:
136+
137+
- Pass through orchestrator
138+
- Are validated by authority
139+
140+
👉 Prevents unauthorized session manipulation
141+
142+
### 🔁 Irreversible Revocation
143+
- Revoked chains cannot be restored
144+
- Revoked sessions remain invalid
145+
146+
👉 Ensures strong security guarantees
147+
148+
### 🔗 Identity Boundaries
149+
150+
- Session → temporary identity proof
151+
- Chain → device trust boundary
152+
- Root → global identity state
153+
154+
👉 Logout operates within these boundaries
155+
156+
<br>
157+
158+
## 🧠 Mental Model
159+
If you remember one thing:
160+
161+
👉 Logout = ending a session
162+
👉 Revoke = resetting trust
163+
164+
## 📌 Key Takeaways
165+
166+
- Logout and revoke are different operations
167+
- Logout is reversible (via re-login)
168+
- Revoke is permanent and forces new authentication
169+
- Device (chain) is a first-class concept
170+
- Security is enforced through authority and orchestrator
171+
172+
## ➡️ Next Step
173+
174+
Continue to **Session Lifecycle**

0 commit comments

Comments
 (0)