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

Proposal for the parameters of AddProtectedApi ... methods #69

Merged
merged 3 commits into from
Mar 31, 2020

Conversation

jmprieur
Copy link
Collaborator

I propose to get rid of hybrid methods, that is provide only:

  • configuration and section name
  • or delegates to set the option (several delegates)

@jennyf19 : let's discuss this when/if you have time.

I propose to get rid of hybrid methods, that is provide only:
- configuration and section name
- or delegates to set the option (several delegates)
Copy link
Contributor

@pmaytak pmaytak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the proposed changes make sense.

}
/// <summary>
/// Protects the Web API with Microsoft identity platform (formerly Azure AD v2.0)
/// This supposes that the configuration files have a section named configSectionName (typically "AzureAD")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is no longer applicable.


builder.Services.AddHttpContextAccessor();
builder.Services.AddSingleton<IJwtBearerMiddlewareDiagnostics, JwtBearerMiddlewareDiagnostics>();

// Change the authentication configuration to accommodate the Microsoft identity platform endpoint (v2.0).
builder.AddJwtBearer(jwtBearerScheme, options =>
{
var microsoftIdentityOptions = configuration.GetSection(configSectionName).Get<MicrosoftIdentityOptions>();
// TODO:
// Suspect. Why not get the IOption<MicrosoftIdentityOptions>?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

bool subscribeToJwtBearerMiddlewareDiagnosticsEvents = false)
{
builder.Services.Configure(jwtBearerScheme, jwtOptionsMapper);
builder.Services.Configure<MicrosoftIdentityOptions>(microsoftIdentityOptionsMapper);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the generic type can be removed, since it can be inferred or we can add one in the line above for consistency and if we want to be explicit or not. (Same applied to similar methods below).

@jennyf19
Copy link
Collaborator

Looks good. I'll take a look at the related web app work. thanks.


In reply to: 383584388 [](ancestors = 383584388)

@jmprieur
Copy link
Collaborator Author

@jennyf19 @pmaytak : I'm wondering if we should not remove the hybrid ones (mixing the section and delegates)

Copy link
Contributor

@pmaytak pmaytak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jmprieur jmprieur merged commit 14b5a41 into master Mar 31, 2020
@jmprieur jmprieur deleted the jmprieur/proposalForOptionsInWebApis branch April 24, 2020 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants