Commit graph

108 commits

Author SHA1 Message Date
Keith Martin
b6687b6c29
Tests: Improve isolation and add fixes #5263
* Tests: fix random selection of deleted record causing test failure
* Tests: fix test folders being left after test
* Tests: ensure that required records are available
* Tests: make each package execute against it's own testdata folder to ensure no interpackage test failures
* Tests: add unit tests of CleanupTestFolder
* Tests:  Allow defer in TestMain
* Tests: rename testMain to runTestMain
2026-07-12 05:47:21 +02:00
Michael Mayer
9d0aca64b8 OIDC: Add configurable authorization prompt option #5698
Add PHOTOPRISM_OIDC_PROMPT (--oidc-prompt) to forward the OpenID Connect
"prompt" parameter (login, select_account, consent) on the authorization
request, so a rejected user can re-authenticate or pick another account
instead of being silently signed in again. Unsupported values (including
"none", which would break interactive login) are dropped with a warning;
empty preserves the seamless-SSO default.
2026-06-27 12:35:04 +00:00
Michael Mayer
80437299da OIDC: Send and validate a nonce on authorization requests #5695 2026-06-25 16:54:29 +02:00
Michael Mayer
11c074cb85 Auth: Delegate cluster OIDC logout to the Portal end-session endpoint #5684
On a cluster-OIDC Sign-Out the instance now delegates the Portal session and the
upstream RP-logout to the Portal's end-session endpoint instead of doing them
itself: revokePeerSessions skips the Portal peer's backend DELETE (still clearing
its storage), and DeleteSession skips clearing the OP session cookie when it
returns a providerLogoutUri — otherwise the Portal OP could not resolve the
session (via that cookie) to chain the upstream logout. onLogout now resolves to
the chosen landing URL so the /logout route guard follows the provider logout URL
too. Adds the oidcLogout client-config accessor and an instance.portal session
marker so the Portal peer is identified explicitly rather than by URL shape.
2026-06-24 15:22:04 +00:00
Michael Mayer
50976f427e Auth: Add RP-initiated OIDC logout via PHOTOPRISM_OIDC_LOGOUT #5684 #5433
Sign-out of an OIDC session redirects the browser to the provider's
discovered end_session_endpoint (id_token_hint + absolute
post_logout_redirect_uri) when PHOTOPRISM_OIDC_LOGOUT is enabled, so the
provider SSO session ends and the next login re-prompts. Opt-in (default
off); local/LDAP logout and providers without an end-session endpoint fall
back to local logout.

Adds the shared CE /api/v1/oauth/logout route and OAuthLogoutHandler hook
plus the Portal OP end_session_endpoint advertised in the Portal discovery
document, for Portal builds to serve via the override hook.
2026-06-24 17:21:00 +02:00
Cathie Integra
3f096a592b Links: Use canonical trailing-slash form for website URLs 2026-06-24 17:20:30 +02:00
Michael Mayer
74a95fc748 ACL: Generate CLI role & auth-provider help from role tables #5667
Add pkg/txt.JoinOr plus acl.RolesCliUsageString and UserRoleUsageFor so the users/clients --role and --auth help derive from the role tables instead of hand-maintained literals, filtering the app/uploader aliases and visitor. Each edition lists its own roles; federatable contexts (LDAP, OIDC group-role, cluster grants) use ClusterInstanceRoles.
2026-06-16 11:57:44 +02:00
Cathie Integra
f1d5ae2ba2 ACL: Add ClusterInstanceRoles source of truth for group-role help 2026-06-16 09:32:15 +02:00
Michael Mayer
bc327016ad Metadata: Add Camera Make and Model updates via CLI & API #5663 #5656
Mirror the lens make/model editing surface for cameras: entity UpdateMakeModel/SaveForm, form validation, query, search, the GET/PUT /api/v1/cameras endpoints, and the cameras CLI command, plus a cameras ACL resource and scope.

Also tidy the lens surface for parity: self-validating SaveForm, empty make/model guard, X-Count search header, service-role grant, the empty-id/slug docs, and order cameras before lenses everywhere.
2026-06-15 09:25:44 +00:00
Keith Martin
c3eda657fd
Metadata: Add Lens Make and Model updates via CLI & API #5644 #5656
Adds the ability to override a lens's Make/Model (e.g. fixing Pentax lenses that ExifTool decodes as `4 38`) via a new photoprism lenses update CLI command and a `PUT /api/v1/lenses/:id endpoint`, plus a `GET /api/v1/lenses` search endpoint, a new lenses ACL resource, and an lenses ls list command.
2026-06-15 09:37:32 +02:00
Michael Mayer
e1bf7096c8 Cluster: Accept all instance roles in group config, tolerate spaces 2026-06-13 12:54:54 +00:00
Michael Mayer
e308fd7b58 Auth: Land cluster sign-out on the Portal login without return_to 2026-06-12 19:56:44 +00:00
Michael Mayer
d091958a60 Cluster: Collect OIDC groups at login for group-based admission 2026-06-12 16:08:38 +00:00
Michael Mayer
e8a04a7d4f JWT: Bound the JWKS response read size 2026-06-11 10:02:17 +00:00
Michael Mayer
d0d956410c OIDC: Scope the RP state cookie to the instance OIDC base path
The relying-party state and PKCE cookies were left at the zitadel default Path=/, so on a shared-domain proxy (instances served under /i/<tenant>) they reached the callback only if the proxy rewrote the Set-Cookie path. They are now scoped to <base>/api/v1/oidc, covering both the login leg and the redirect callback, so they survive to the callback regardless of any proxy rewrite.
2026-06-09 15:36:35 +00:00
Michael Mayer
7881849b63 Cluster: Redirect cluster-OIDC sign-out to the Portal login
A user who signed in via cluster OIDC now returns to the Portal login (re-auth via OIDC) on sign-out instead of the instance's local form. The /logout route awaits the cluster-wide sign-out so the Portal OP cookie is cleared before the redirect, avoiding a silent re-SSO.
2026-06-09 15:36:24 +00:00
Michael Mayer
7232cc23a4 OIDC: Render a branded page when the RP code exchange fails
The OIDC RP callback handler returned without writing a response when
CodeExchangeUserInfo failed (e.g. a missing/expired state cookie), leaving
the raw zitadel error ("failed to get state: http: named cookie not present")
on screen with no way forward. CodeExchangeUserInfo now runs the exchange
against a recorder so the handler's raw error never reaches the browser, and
the callback renders the branded auth.gohtml page (which returns the user to
login) instead of a dead-end. Set-Cookie headers from a successful exchange
are still propagated.
2026-06-09 13:11:02 +00:00
Ömer Duran
fddab77506
Auth: Apply Portal-granted role on OIDC instance login
Honor the pp_role claim (gated by pp_issuer_kind) over the group mapping so an instance login reflects the role the Portal granted, restricted to federatable roles.
2026-06-05 21:03:36 +02:00
Michael Mayer
d48ef12c99 Auth: Keep OIDC RP state and PKCE cookies Secure on HTTPS
Gate the OIDC relying-party cookie handler's WithUnsecure() on the existing
insecure flag instead of applying it unconditionally, so the round-trip state
(CSRF defense) and PKCE code_verifier cookies retain the Secure attribute on
HTTPS deployments. Addresses audit finding OJW-260603-02 (GO-HTTP-005).
2026-06-03 16:10:39 +00:00
Michael Mayer
6b8ae165fb Auth: Accept EdDSA ID tokens in the OIDC relying party 2026-06-03 17:12:59 +02:00
Michael Mayer
c908ec5563 Auth: Advertise use and alg in the Ed25519 JWKS 2026-06-03 17:12:59 +02:00
Michael Mayer
fbe8a6889b Auth: Add cluster_admin role with admin-tier and federation helpers
Adds the Portal-only cluster_admin operator role (declared in CE, registered
only on Portal builds), the acl.AdminRoles/IsAdminRole admin-tier set, and the
acl.IsFederatedRole/FederatedRoleUpdate helpers that keep cluster_admin and
visitor out of externally mapped account roles. SuperAdmin resolves to
cluster_admin on registered builds, SaveForm keeps an admin-level role on a
self-save, and UpdateUser rejects self-role changes. RoleStrings.Strings hides
visitor and none from the CLI role help.
2026-06-03 17:12:59 +02:00
Michael Mayer
87f3f6a64a Backend: Recover from panics in background tasks and album restore #5637 2026-06-03 07:45:07 +00:00
Michael Mayer
570a563748 Docs: Bump copyright year to 2026 in Go package headers 2026-05-25 14:39:38 +00:00
Michael Mayer
1618d5cd98 Auth: Use acl.RolePortal for pp_issuer_kind instead of local constant 2026-05-24 06:36:41 +00:00
Michael Mayer
f33cce28e4 Auth: Add IssueUser for Portal OIDC ID/access tokens 2026-05-24 06:29:08 +00:00
Michael Mayer
44429bdbbb MCP: Gate stdio on DisableMCP and add scope regression test #5024 2026-05-10 11:54:34 +00:00
Michael Mayer
df13ea9e02 MCP: Refine auth flow, JWT scope, and find_search_filters #5024 #5519
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-04-10 13:40:22 +02:00
Ömer Duran
e2f8474309
MCP: Add read-only Model Context Protocol prototype #5024 #5519
* MCP: Add internal read-only prototype #5024

* MCP: Fix edition detection, section assignment, and input validation #5024

* MCP: Add authenticated HTTP endpoint with ACL and experimental gate #5024

* MCP: Document client compatibility and config examples #502

* MCP: Refine ACL grants and finalize prototype polish #5024 #5519

Signed-off-by: Michael Mayer <michael@photoprism.app>

* MCP: Update go.sum #5024 #5519

Signed-off-by: Michael Mayer <michael@photoprism.app>

* MCP: Update license NOTICE files #5024 #5519

Signed-off-by: Michael Mayer <michael@photoprism.app>

---------

Signed-off-by: Michael Mayer <michael@photoprism.app>
Co-authored-by: Michael Mayer <michael@photoprism.app>
2026-04-10 12:51:11 +02:00
Michael Mayer
898e8aa9d1 Audit: Add trace helper for quiet session cleanup logs
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-03-29 14:21:18 +02:00
Michael Mayer
f2aabb9bcd Security: Add gosec fixes with shared URL and fs validation helpers
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-03-03 16:38:41 +01:00
Michael Mayer
532ddbd270 ACL: Add "audit" permission for audit API endpoints
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-03-01 17:24:49 +01:00
Michael Mayer
d5ecab8827 Proxy: Define /i/ as DefaultPathPrefix for shared-domain deployments
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-24 01:15:23 +01:00
Michael Mayer
a0070dce1c Cluster: Improve usage of canonical terms in code/docs based on glossary
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-23 16:16:29 +01:00
Michael Mayer
c1467cb3f5 Cluster: Rename the "tenant" node role to "instance" for accuracy
This more accurately reflects the multi-instance architecture.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-23 04:27:43 +01:00
Michael Mayer
5f50802384 Cluster: Rename the "app" node role to "tenant"
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-23 03:27:11 +01:00
Michael Mayer
45bfdf30c3 Docs: Update paths in README.md, AGENT.md, and CODEMAP.md
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-22 15:33:19 +01:00
Michael Mayer
a2b7615c93 Go: Apply go fix modernizations across backend packages
Run `go fix ./...` and keep mechanical modernization updates.

- Replace `interface{}` with `any` in signatures and local types
- Apply formatter/style cleanups from go1.26 tooling
- Keep `omitempty` behavior-preserving simplifications suggested by fix
- No functional feature changes intended

Validation:
- go test ./... -run '^$' -count=1 (Go 1.26.0)
- GOTOOLCHAIN=go1.24.10 go test ./... -run '^$' -count=1

Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-20 03:54:33 +01:00
Michael Mayer
6867626c9a Docs: Shorten "Context & Constraints" to "Constraints"
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-14 08:23:27 +01:00
Michael Mayer
c6c16c5355 OIDC: Update Keycloak client settings in scripts/sql/mariadb-init.sql
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-10 12:34:42 +01:00
Michael Mayer
9fbef7cf64 WebDAV: Improve redirect and read/write request method handling
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-10 11:45:32 +01:00
Michael Mayer
f07f46fec8 Backend: Clean up error handling and unit tests in internal/ packages
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-09 12:00:33 +01:00
Michael Mayer
22e3c6d6d8 Metrics: Adjust ACL rules for endpoint access #5355
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-30 11:05:32 +01:00
Michael Mayer
bf781b9b37 OIDC: Add "Entra App Roles" section to README.md #5334
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-27 15:28:07 +01:00
Michael Mayer
53b21eb5a0 OIDC: Update README.md #5334
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-27 13:16:10 +01:00
Michael Mayer
66599070f1 OIDC: Update README.md #5334
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-27 12:06:48 +01:00
Michael Mayer
6318c3ddc8 OIDC: Update README.md #5334
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-27 12:06:17 +01:00
Michael Mayer
6c50ee0ade OIDC: Merge groups, add inline code docs, and improve README.md #5334
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-27 12:02:57 +01:00
Michael Mayer
9d378f2041 OIDC: Update README.md #5334
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-27 11:52:54 +01:00
Michael Mayer
3d90ab1468 OIDC: Update internal/auth/oidc/README.md #5334
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-23 16:38:53 +01:00