mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-17 16:49:04 +00:00
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.
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package oidc
|
|
|
|
import (
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
)
|
|
|
|
// init initializes the package.
|
|
func init() {
|
|
// Register OpenID Connect extension.
|
|
config.Register(config.StageInit, "oidc", InitConfig, ClientConfig)
|
|
}
|
|
|
|
// ClientConfig returns the OIDC client config values.
|
|
func ClientConfig(c *config.Config, t config.ClientType) config.Values {
|
|
result := config.Values{
|
|
"enabled": c.OIDCEnabled(),
|
|
"provider": c.OIDCProvider(),
|
|
"icon": c.OIDCIcon(),
|
|
"register": c.OIDCRegister(),
|
|
"redirect": c.OIDCRedirect(),
|
|
// logout lets the UI know sign-out will redirect to the provider's end-session
|
|
// endpoint; the backend still drives the actual redirect URL.
|
|
"logout": c.OIDCLogout(),
|
|
"loginUri": c.OIDCLoginUri(),
|
|
// cluster lets the frontend route a cluster-OIDC sign-out to the Portal login.
|
|
"cluster": c.ClusterOIDC(),
|
|
// portalLoginUri is the Portal's browser-facing login page (persisted from
|
|
// the register response), so sign-out lands there without re-initiating
|
|
// the instance OIDC roundtrip and pinning a return_to.
|
|
"portalLoginUri": c.PortalLoginUrl(),
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
// InitConfig initializes the OIDC config options.
|
|
func InitConfig(c *config.Config) error {
|
|
return nil
|
|
}
|