Commit 2315fff
committed
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
- 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
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>1 parent 63fc774 commit 2315fff
2 files changed
Lines changed: 478 additions & 201 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