Skip to content
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

Make a way to configure more options in TokenValidationParameters using simplified authentication configuration #55389

Open
1 task done
andyolivares opened this issue Apr 26, 2024 · 0 comments
Labels
area-security enhancement This issue represents an ask for new feature or an enhancement to an existing one
Milestone

Comments

@andyolivares
Copy link

andyolivares commented Apr 26, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I'm working on a project where I'm using JWT Bearer tokens with simplified auth configuration like this:

builder.Services.AddAuthentication().AddJwtBearer();

My appsettings.json looks like this:

{
  "Authentication": {
    "Schemes": {
      "Bearer": {
        "Authority": "...",
        "MetadataAddress": "...",
        "ValidIssuer": "...",
        "ValidAudiences": [ "account" ]
      }
    }
  }
}

My application uses an OIDC server that has a different NameClaimType than ASP.NET Security's default. It would be great to be able to specify that in the same configuration (along with RoleClaimType and maybe other options left behind). Something like this:

{
  "Authentication": {
    "Schemes": {
      "Bearer": {
        "Authority": "...",
        "MetadataAddress": "...",
        "ValidIssuer": "...",
        "ValidAudiences": [ "account" ],
        "TokenValidationParameters": {
          "NameClaimType": "name"
        }
      }
    }
  }
}

Describe the solution you'd like

It would be straightforward to add a few more options in JwtBearerConfigureOptions.cs to configure TokenValidationParameters further from configuration.

I could make a PR myself. Let me know what you think.

Additional context

No response

@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label May 2, 2024
@mkArtakMSFT mkArtakMSFT added this to the Backlog milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-security enhancement This issue represents an ask for new feature or an enhancement to an existing one
Projects
None yet
Development

No branches or pull requests

2 participants