Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

WeihanLi
Copy link
Contributor

@WeihanLi WeihanLi commented Mar 29, 2025

Description

Try to support configure additional ClaimMap for the OpenIdConnect authentication

Fixes #7755

verified locally

Image

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": "MapJsonKey:role:role"
      }
    }
  }
}

environment sample:

  - name: Dashboard__Frontend__AuthMode
    value: "OpenIdConnect"
  - name: Dashboard__Frontend__OpenIdConnect__ClaimActions
    value: "MapJsonKey:role:role"
  - name: Dashboard__Frontend__OpenIdConnect__RequiredClaimType
    value: "role"
  - name: Dashboard__Frontend__OpenIdConnect__RequiredClaimValue
    value: "Aspire"

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@Copilot Copilot AI review requested due to automatic review settings March 29, 2025 00:12
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 29, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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>
@WeihanLi
Copy link
Contributor Author

The failed test seems not related to the change

@WeihanLi
Copy link
Contributor Author

@JamesNK could you please help have a look on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dashboard community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard role claim support
1 participant