Skip to content

feat: add support for mapping user admin status from OIDC claims - #1033

Merged
jmattheis merged 3 commits into
gotify:masterfrom
UiP9AV6Y:feature/oidc-claim-mapping
Aug 26, 2026
Merged

feat: add support for mapping user admin status from OIDC claims#1033
jmattheis merged 3 commits into
gotify:masterfrom
UiP9AV6Y:feature/oidc-claim-mapping

Conversation

@UiP9AV6Y

Copy link
Copy Markdown
Contributor

an optional new configuration setting allows operators to define a JMESPath expression to calculate the admin status of a user based on their OIDC claims. this feature can also be used to deny users access alltogether, by mapping their claims to a special role value.

closes #957

@UiP9AV6Y
UiP9AV6Y requested a review from a team as a code owner August 20, 2026 19:40
Comment thread api/oidc.go Outdated
@UiP9AV6Y
UiP9AV6Y force-pushed the feature/oidc-claim-mapping branch 2 times, most recently from 1cda078 to 7c460e4 Compare August 22, 2026 12:59
Some IdPs don't provide or only provide the claims in the ID token /
userinfo. Most clients will check both claims.
Comment thread api/rbac.go Outdated
switch roles := subject.(type) {
case string:
return r.resolveSlice([]string{roles}), nil
case []string:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work. the groups are provided here as []any. (I've already adjusted this).

Comment thread api/rbac.go Outdated

// RBACResolver allows for arbitrary input to be mapped to roles for
// use in a permission system.
type RBACResolver interface {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is pretty overengineered. All this matching and conversion should be done in a single function. This makes this IMO easier to understand. (I've already adjusted this)

@jmattheis
jmattheis force-pushed the feature/oidc-claim-mapping branch from 7c460e4 to 20629d3 Compare August 23, 2026 09:42
@jmattheis

Copy link
Copy Markdown
Member

@eternal-flame-AD Could you take a look at these changes? I've made some larger adjustments and would like a second pair of eyes (:


I've tested this with authentik and Authelia with different combinations of settings and groups.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.14085% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.77%. Comparing base (54deea6) to head (585b9e3).

Files with missing lines Patch % Lines
api/oidc.go 89.70% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1033      +/-   ##
==========================================
+ Coverage   75.49%   75.77%   +0.27%     
==========================================
  Files          66       66              
  Lines        3559     3620      +61     
==========================================
+ Hits         2687     2743      +56     
- Misses        662      666       +4     
- Partials      210      211       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eternal-flame-AD

Copy link
Copy Markdown
Member

sure, will do tonight :)

Comment thread api/oidc.go Outdated
Comment thread gotify-server.env.example

@eternal-flame-AD eternal-flame-AD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

UiP9AV6Y and others added 2 commits August 26, 2026 16:54
@jmattheis
jmattheis force-pushed the feature/oidc-claim-mapping branch from 7c187c9 to 585b9e3 Compare August 26, 2026 14:55
@jmattheis
jmattheis enabled auto-merge August 26, 2026 14:59
@jmattheis
jmattheis added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 26, 2026
@jmattheis
jmattheis added this pull request to the merge queue Aug 26, 2026
Merged via the queue into gotify:master with commit 14bfc25 Aug 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

OIDC: Map group claims to admin user flag

3 participants