Skip to content

Add groups and roles to OIDC requested scopes#1847

Closed
TerrifiedBug wants to merge 2 commits intoTechnitiumSoftware:masterfrom
TerrifiedBug:fix-oidc-groups-scope
Closed

Add groups and roles to OIDC requested scopes#1847
TerrifiedBug wants to merge 2 commits intoTechnitiumSoftware:masterfrom
TerrifiedBug:fix-oidc-groups-scope

Conversation

@TerrifiedBug
Copy link
Copy Markdown

@TerrifiedBug TerrifiedBug commented Apr 25, 2026

Summary

The OIDC client only requests openid profile email. Standards-compliant OIDC providers (PocketID, and any OP that follows the RFC convention of gating optional claims on scopes) therefore never return a groups (or roles) claim, so SsoLoginFinalizeAsync sees an empty claim set and SsoGroupMap lookups never match. The result is that the SSO group-mapping feature is effectively dead code on RFC-strict providers.

Fix

Add groups and roles to the requested scopes in the AddOpenIdConnect configuration in DnsServerCore/DnsWebService.cs. The claim parser at DnsServerCore/WebServiceAuthApi.cs already accepts "groups", "roles" and ClaimTypes.Role — only the request side needed changing.

Standards-compliant OPs silently ignore unknown scopes, so requesting both is safe across providers using either convention (PocketID/Authentik/Keycloak typically use groups; Azure AD / some Okta deployments use roles).

Diff

Two lines in DnsServerCore/DnsWebService.cs only:

                     options.Scope.Add("openid");
                     options.Scope.Add("profile");
                     options.Scope.Add("email");
+                    options.Scope.Add("groups");
+                    options.Scope.Add("roles");

Fixes #1845

Standards-compliant OIDC providers (e.g. PocketID) gate the groups and
roles claims on the corresponding scopes being requested at /authorize.
The client currently sends only "openid profile email", so those claims
are never returned and SsoGroupMap is dead code on such providers.

The claim parser already accepts "groups", "roles" and ClaimTypes.Role
in WebServiceAuthApi.cs; this only makes the OIDC client request them.
@ShreyasZare
Copy link
Copy Markdown
Member

Thanks for the PR. Have fixed this issue with v15.0.1 release.

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.

PocketID OIDC Mapped Groups

2 participants