Add generic OpenID Connect external auth provider #6

Merged
cheapnud merged 2 commits from d/oidc-provider into master 2026-08-17 12:02:09 +00:00
Owner
No description provided.
add generic OpenID Connect external auth provider
All checks were successful
Claude PR Review / AI Code Review (pull_request) Successful in 15s
Build / Build and Test (pull_request) Successful in 2m19s
9024d339b8

🤖 Claude AI Code Review

Summary
Adds a generic OIDC external auth provider with PKCE, group-to-role mapping, and discovery-based configuration. Clean integration into the existing OAuth extension pattern.

Code Quality
Well-documented, sensible defaults, and thoughtful handling of userinfo claim quirks across IdPs.

Issues

🟡 OAuthBlazorExtensions.cs — AddOpenIdConnectAuth registers services.AddSingleton(oidcOptions) as OpenIdConnectAuthOptions, but calling it twice (multiple OIDC providers, which the docs explicitly encourage via unique schemes) will overwrite the singleton. MapOAuthEndpoints only resolves a single OpenIdConnectAuthOptions, so only the last-registered provider gets endpoints mapped. Either document single-provider only, or key the registration by scheme.

🟢 OpenIdConnectAuthOptions.cs — ClientSecret can be null/empty with no validation; only Authority is checked. For confidential clients using code flow this will fail at runtime with a less clear error. Minor, since public clients with PKCE are valid.

🟢 OAuthBlazorExtensions.cs — RoleClaimType/NameClaimType are set on TokenValidationParameters, but groups come from the userinfo endpoint (GetClaimsFromUserInfoEndpoint = true), not the id_token. The ClaimActions.MapJsonKey handles that mapping, so this is fine — just confirm groups actually land as expected given both paths are configured.

Verdict: REQUEST CHANGES

  • Fix the singleton registration/resolution so multiple OIDC providers (as the XML docs advertise) actually work, or explicitly restrict to a single OIDC provider and update the docs accordingly.

📊 Tokens: 5631 input + 654 output | 💰 Cost: ~$0.0445
Generated by Claude Opus 4.8 via Gitea Actions

## 🤖 Claude AI Code Review **Summary** Adds a generic OIDC external auth provider with PKCE, group-to-role mapping, and discovery-based configuration. Clean integration into the existing OAuth extension pattern. **Code Quality** ⭐⭐⭐⭐☆ Well-documented, sensible defaults, and thoughtful handling of userinfo claim quirks across IdPs. **Issues** 🟡 OAuthBlazorExtensions.cs — `AddOpenIdConnectAuth` registers `services.AddSingleton(oidcOptions)` as `OpenIdConnectAuthOptions`, but calling it twice (multiple OIDC providers, which the docs explicitly encourage via unique schemes) will overwrite the singleton. `MapOAuthEndpoints` only resolves a single `OpenIdConnectAuthOptions`, so only the last-registered provider gets endpoints mapped. Either document single-provider only, or key the registration by scheme. 🟢 OpenIdConnectAuthOptions.cs — `ClientSecret` can be null/empty with no validation; only `Authority` is checked. For confidential clients using code flow this will fail at runtime with a less clear error. Minor, since public clients with PKCE are valid. 🟢 OAuthBlazorExtensions.cs — `RoleClaimType`/`NameClaimType` are set on `TokenValidationParameters`, but groups come from the userinfo endpoint (`GetClaimsFromUserInfoEndpoint = true`), not the id_token. The `ClaimActions.MapJsonKey` handles that mapping, so this is fine — just confirm groups actually land as expected given both paths are configured. **Verdict**: REQUEST CHANGES - Fix the singleton registration/resolution so multiple OIDC providers (as the XML docs advertise) actually work, or explicitly restrict to a single OIDC provider and update the docs accordingly. --- 📊 **Tokens**: 5631 input + 654 output | 💰 **Cost**: ~$0.0445 *Generated by Claude Opus 4.8 via Gitea Actions*
state pkce explicitly, document scope and multi-provider caveats
All checks were successful
Claude PR Review / AI Code Review (pull_request) Successful in 17s
Build / Build and Test (pull_request) Successful in 2m25s
4c37d0414e
cheapnud merged commit 022f7e86d6 into master 2026-08-17 12:02:09 +00:00
cheapnud deleted branch d/oidc-provider 2026-08-17 12:02:09 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cheapnud/CheapHelpers!6
No description provided.