-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
JwtBearer doesn't populate the ValidIssuer and the ValidAudience properties of the JwtBearerOptions.TokenValidationParameters. #52820
Comments
I'll also provide a PR (I just need a little bit of time). |
I believe this was intentional. #42679 (comment)
@satma0745 Is there a scenario that blocks you by not having these properties? |
@Kahbazi, there are no scenario that blocks me, but it just felt counter-intuitive to have such behavior. And about that
|
Guess, there's no point in discussing that topic in the separate Issue any more, so I'll do it here. Suppose, we have the following configuration: {
"ValidAudience": "A",
"ValidAudiences": [ "B", "C" ]
} With the current behavior we'll end up with the following {
ValidAudience = null,
ValidAudences = new string[] { "A", "B", "C" }
} And it doesn't look right to me: it basically looks like we just copied over value and that there's just 2 sources for the Basically, I'd be satisfied with one of the following decisions:
I'm quite happy with any of these options as long as we can all agree on it, although my favorite is the 3rd one. |
Fixed by #52821. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
The JwtBearerConfigureOptions class reads values for both the ValidIssuer and the ValidAudience from the configuration and even saves them to the ValidIssuers and ValidAudiences collections in the TokenValidationParameters, but completely ignores the corresponding ValidIssuer and ValidAudience properties of the same TokenValidationParameters.
The simplified representation of what is happening right now:
Note
Please note that this is a very abbreviated code example and that it differs significantly from the actual JwtBearerConfigureOptions.Configure method implementation.
Describe the solution you'd like
I would like that if configuration explicitly specifies a value for the ValidIssuer and ValidAudience, that value will end up in the TokenValidationParameters.
Basically, I would like the JwtBearerConfigureOptions.Configure method to also populate the ValidIssuer and the ValidAudience properties too:
The text was updated successfully, but these errors were encountered: