Skip to content

Link OIDC users to Headscale users via providerId#479

Closed
drifterza wants to merge 1 commit intotale:mainfrom
drifterza:fix/issue-387-oidc-reconciliation
Closed

Link OIDC users to Headscale users via providerId#479
drifterza wants to merge 1 commit intotale:mainfrom
drifterza:fix/issue-387-oidc-reconciliation

Conversation

@drifterza
Copy link
Contributor

@drifterza drifterza commented Feb 27, 2026

Related to #387

When oidc.integrate_headscale is enabled, Headplane matches the OIDC subject to Headscale users by extracting the subject from their providerId field (format: oidc/subject123). The matched Headscale user ID is stored in the database for future permission assignment.

Changes:

  • Added headscale_user_id column to users table via migration
  • Added integrate_headscale config option under oidc section
  • OIDC callback queries Headscale API to find matching users
  • Links are stored and updated on each login

API key authentication continues to work without onboarding (handled by existing shell loader check).

This PR handles the backend OIDC linking. See #481 for the complementary onboarding UI changes.

@drifterza drifterza requested a review from tale as a code owner February 27, 2026 10:37
@drifterza drifterza force-pushed the fix/issue-387-oidc-reconciliation branch 4 times, most recently from 54c3717 to 1d502bb Compare February 27, 2026 11:01
@tale
Copy link
Owner

tale commented Mar 7, 2026

I'm not really a fan of this implementation because it should be seamless and unless I'm mistaken, I had originally wrote it to match against the provider ID anyways, hence the stipulation that for Headscale and Headplane to work together they need to use the exact same OIDC provider otherwise they would fail.

@don-cline
Copy link

Closing - the auth rework (PR #489) already handles OIDC user matching in oidc-callback.ts. The linkHeadscaleUser call there does exactly what this PR was trying to do.

1 similar comment
@drifterza
Copy link
Contributor Author

Closing - the auth rework (PR #489) already handles OIDC user matching in oidc-callback.ts. The linkHeadscaleUser call there does exactly what this PR was trying to do.

@drifterza drifterza closed this Mar 10, 2026
@drifterza drifterza deleted the fix/issue-387-oidc-reconciliation branch March 10, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants