immich/server
Imperator Ruscal a560e08693
fix: re-evaluate OIDC role claim on every login and support array values (#29991)
* fix(server): re-evaluate OIDC role claim on every login and support array values

Previously the OIDC role claim (immich_role) was only read at user
auto-registration time and only accepted as a scalar string, so admin
status never updated after the first login and array-valued role/group
claims (common with Keycloak, Entra ID, etc.) were silently ignored.

Now the role claim is normalized from either a string or an array of
strings, and existing users have their isAdmin flag synced from the
claim on every login, keeping the IdP as the source of truth for
privileges while leaving isAdmin untouched when the claim is blank.

* fix(server): use .includes() instead of .some() for role claim check

Satisfies unicorn/prefer-includes lint rule flagged by CI.

* fix(server): resolve missing role claim to standard user and fix test mock

Default the OIDC role claim to 'user' when the IdP omits it so
auto-registration doesn't crash, and add the missing getAdmin mock in the
auth.service test so it correctly simulates an existing admin rather than
the first-user-registration path.

* fix: claim sync logic

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
2026-07-21 17:21:19 -04:00
..
bin fix(server): memory fragmentation (#27027) 2026-03-26 18:21:52 +01:00
src fix: re-evaluate OIDC role claim on every login and support array values (#29991) 2026-07-21 17:21:19 -04:00
test fix: album update event emitting (#30120) 2026-07-21 19:43:27 +00:00
.gitignore
.npmignore chore: use pnpm for builds (#19752) 2025-08-19 08:55:24 -04:00
.prettierignore refactor: migrate map repository to kysely (#15348) 2025-01-17 09:14:42 -06:00
.prettierrc
Dockerfile chore(deps): update base-image to v202607211135 (#30090) 2026-07-21 13:58:02 +02:00
Dockerfile.dev chore(deps): update base-image to v202607211135 (#30090) 2026-07-21 13:58:02 +02:00
eslint.config.mjs chore(deps): update dependency eslint-plugin-unicorn to v72 (#30092) 2026-07-21 15:33:46 +02:00
helmet.json fix(server): updated default CSP config to support videos from V3 player (#29830) 2026-07-15 12:49:18 +02:00
mise.toml refactor: plugin sdk types (#28674) 2026-05-28 22:04:15 +00:00
nest-cli.json fix: isolate docker host/container filesystem for node_modules and build output (#21167) 2025-08-24 13:09:45 -05:00
package.json chore(deps): update dependency eslint-plugin-unicorn to v72 (#30092) 2026-07-21 15:33:46 +02:00
tsconfig.build.json chore: move .tsbuildinfo file to dist folder (#27682) 2026-04-10 16:02:25 +02:00
tsconfig.json chore(deps): update dependency eslint-plugin-unicorn to v70 - abandoned (#29684) 2026-07-20 23:47:14 -04:00