Commit 30e2188
refactor: modernize session management and token validation
- Extract bearer token parsing, OIDC config reading, validator
instantiation, NC provider validation, and user resolution into
dedicated private methods to reduce cognitive complexity of
getCurrentUserId()
- Replace the first-match-wins loop with findUniqueTokenMatch(), which
requires unambiguous validation across all providers: a token accepted
by more than one (provider, userId) pair is rejected with a warning
- Add countUsers() via a direct COUNT(*) query instead of fetching all
UIDs into memory
- Introduce SESSION_USER_DATA, SESSION_PASSWORD_CONFIRM, and
PASSWORD_CONFIRM_TTL constants to avoid magic strings/numbers
- Use ITimeFactory for the password-confirm session timestamp
- Fix first-login setup: move getUserFolder() inside the try/catch so a
NotFoundException from storage setup no longer aborts login
- Keep $existingUser null when a user is freshly created via getOrCreate()
so provisionUser() is not passed the wrong identity when UNIQUE_UID or
PROVIDER_BASED_ID cause the stored ID to differ from the token sub
- Add doc blocks to all new private methods, with extended descriptions
for methods that change observable backend behaviour
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent c6fd933 commit 30e2188
2 files changed
Lines changed: 477 additions & 200 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
172 | 190 | | |
0 commit comments