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

[Bug] Custom TokenValidationParameters.ValidAudiences is overwritten #52

Closed
1 of 8 tasks
TiagoBrenck opened this issue Mar 12, 2020 · 1 comment · Fixed by #103
Closed
1 of 8 tasks

[Bug] Custom TokenValidationParameters.ValidAudiences is overwritten #52

TiagoBrenck opened this issue Mar 12, 2020 · 1 comment · Fixed by #103
Assignees
Labels
bug Something isn't working fixed P1

Comments

@TiagoBrenck
Copy link
Contributor

Which Version of Microsoft Identity Web are you using ?
preview

Where is the issue?

  • Web App
    • Sign-in users
    • Sign-in users and call web APIs
  • Web API
    • Protected web APIs (Validating tokens)
    • Protected web APIs (Validating scopes)
    • Protected web APIs call downstream web APIs
  • Token cache serialization
    • In Memory caches
    • Session caches
    • Distributed caches

Other? - please describe;

Repro
As a developer, I might want to have my valid audience to be https://<tenantDomain> instead of api://<guid>.

For that I could use:

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
                .AddProtectedWebApi("AzureAd", Configuration, options =>
                {
                    Configuration.Bind("AzureAD", options);
                    options.TokenValidationParameters.ValidAudiences = new List<string> { "https://<myTenantDomain>" };
                });

Expected behavior
Have the options.TokenValidationParameters.ValidAudiences set with my custom option.

Actual behavior
The method EnsureValidAudiencesContainsApiGuidIfGuidProvided() is overwriting my audiences in its logic.

Possible Solution
Have EnsureValidAudiencesContainsApiGuidIfGuidProvided() to extend my options and not overwrite it.

Additional context/ Logs / Screenshots
Add any other context about the problem here, such as logs and screenshots.

@jmprieur jmprieur added the enhancement New feature or request label Mar 13, 2020
@jmprieur jmprieur added bug Something isn't working and removed enhancement New feature or request labels Mar 24, 2020
@jmprieur jmprieur added the P1 label Mar 27, 2020
@jennyf19 jennyf19 added this to the 0.2 - preview milestone Apr 3, 2020
@pmaytak pmaytak self-assigned this Apr 10, 2020
@pmaytak pmaytak added fixed and removed In progress labels Apr 17, 2020
@jennyf19
Copy link
Collaborator

included in 0.1.1-preview release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed P1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants