Feature: Add OpenID Connect auth#1018
Open
Kogoro wants to merge 3 commits into
Open
Conversation
Glance can now authenticate users through standard OIDC providers while keeping optional local username/password login for break-glass access. Co-authored-by: Cursor <cursoragent@cursor.com>
Consolidate rate limiting, cookie helpers, and claim resolution; drop redundant oidcUsernames tracking and fix username hash map concurrency. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop configurable scopes and username-claim; openid alone is enough to authenticate and identify users via the ID token sub claim. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds optional OpenID Connect (OIDC) authentication to Glance alongside the existing local username/password flow. My problem with the current username/password flow is that on one of my notebooks I cant have a good password manager installed/used. Using a OIDC provider solves pretty much all my hassle and glance still has the same functionality for one dashboard.
Users can sign in via any standard OIDC provider (Keycloak, PocketID, Authelia, Google, etc.) using a "Sign in with SSO" button on the login page. After IdP authentication, Glance issues the same HMAC session cookie used by local login.
The feature can be used alone or together with local users. I limited the scope to OpenID only, as that's all that is really needed.
As I am currently time-constrained, the PR is authored with the help of Cursor and CE-Skills. Keep that in mind. If it is not the direction glance should/will be heading, it's ok to close the PR.
Configuration
Register redirect URI: {base-url}/auth/oidc/callback
Optional flags: auto-login, disable-local-login, redirect-url
Implementation notes
Authorization code flow with PKCE, signed state cookie, nonce validation, and ID token verification via go-oidc
Shared rate limiting and cookie helpers with existing local auth
Config hot-reload re-inits the OIDC provider like other auth settings
Login UI supports SSO-only, local-only, or both
Test plan
One line worth calling out for reviewers: OIDC user sessions are tied to in-memory sub → hash mappings, so they don't survive a config reload until the user signs in again (same pattern as removing a local user from config).