-
Notifications
You must be signed in to change notification settings - Fork 733
support ClaimActions configure for dashboard #8396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support ClaimActions configure for dashboard #8396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for configuring additional ClaimActions for OpenIdConnect authentication via a new property in DashboardOptions. It enables claim action configuration through a semicolon-separated string of commands that are parsed and applied during dashboard authentication setup.
- Introduces ClaimActions configuration in DashboardOptions.
- Parses and applies ClaimActions in DashboardWebApplication.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Aspire.Dashboard/DashboardWebApplication.cs | Adds logic to parse and apply custom ClaimActions for OpenIdConnect. |
| src/Aspire.Dashboard/Configuration/DashboardOptions.cs | Adds a new string property to hold the ClaimActions configuration. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
The failed test seems not related to the change |
|
@JamesNK could you please help have a look on this |
|
@WeihanLi sorry for letting this go stale. This change has no tests and no scenario that we can verify (we need to be able to prevent regressions). Do you still want this PR merged? Is so, can you figure out what tests would be best to add? |
Will try to add test cases this weekend @davidfowl thanks for the comment, great to hear some feedback |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 8396Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 8396" |
| Assert.Contains(oidcOption.ClaimActions, x => x.ClaimType == claimAction.ClaimType && x.ValueType == claimAction.ValueType); | ||
| var action = oidcOption.ClaimActions.FirstOrDefault(x => x.ClaimType == claimAction.ClaimType); | ||
| Assert.NotNull(action); | ||
| var jsonElement = JsonDocument.Parse(""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use JsonElement.Parse when we update to .NET 10
|
Merged. I made some minor clean up changes. Thanks @WeihanLi |
Description
Try to support configure additional ClaimMap for the OpenIdConnect authentication
Fixes #7755
verified locally
usage example:
{ "Authentication": { "Schemes": { "OpenIdConnect": { "Authority": "https://id.weihanli.xyz", "ClientId": "aspire", "ClientSecret": "", "GetClaimsFromUserInfoEndpoint": true, "Scope": [ "roles" ] } } }, "Dashboard": { "Frontend": { "AuthMode": "OpenIdConnect", "OpenIdConnect": { "RequiredClaimType": "role", "RequiredClaimValue": "Aspire", "ClaimActions": [ { "ClaimType": "role", "JsonKey": "role" } ] } } } }environment sample:
Checklist
<remarks />and<code />elements on your triple slash comments?breaking-changetemplate):doc-ideatemplate):