-
Notifications
You must be signed in to change notification settings - Fork 3
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
Introduces IAuthorizationHeaderProviderExtension #129
Conversation
src/Microsoft.Identity.Abstractions/DownstreamApi/IAuthorizationHeaderProviderExtension.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Abstractions/ApplicationOptions/RequestContext.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Abstractions/DownstreamApi/IAuthorizationHeaderProviderExtension.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Abstractions/DownstreamApi/IAuthorizationHeaderProviderExtension.cs
Outdated
Show resolved
Hide resolved
6f84321
to
762e446
Compare
src/Microsoft.Identity.Abstractions/DownstreamApi/IAuthorizationHeaderProvider.cs
Show resolved
Hide resolved
b425ad5
to
2c7fd8e
Compare
/// <param name="cancellationToken">A token to cancel the operation.</param> | ||
/// <returns>A string containing the authorization header, such as "Bearer token" or "PoP token".</returns> | ||
Task<string> CreateAuthorizationHeaderAsync( | ||
IEnumerable<string> scopes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to pass IEnumerable can it be IList?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IEnumerable is consistent with the CreateAuthorizationHeaderForUserAsync signature. However, sometimes we manipulate the scopes (like adding default ones), in that case IList would be better. I prefer the IList, unless you'd prefer IEnumerable for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supposed to be immutable. No need to manipulate anything. IEnumerable is the base interface for string[], IList etc ...
src/Microsoft.Identity.Abstractions/DownstreamApi/IAuthorizationHeaderProvider.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Abstractions/DownstreamApi/IAuthorizationHeaderProvider.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks @sruke
You might want to up the version in ?
<ClientSemVer Condition="'$(ClientSemVer)' == ''">5.2.0-local</ClientSemVer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What?
This PR updates the IAuthorizationHeaderProvider interface to include the CreateAuthorizationHeaderAsync API. This new API allows for acquiring an authorization header on behalf of either a user or an application. This is a breaking change. To accomodate it Microsoft.Identity.Abstractions will update its major version.
Why?
The current interface exposes separate APIs for obtaining headers on behalf of a user and an app.
The existing method for acquiring a header on behalf of an app does not accept a ClaimsPrincipal, limiting the flexibility and usability of the current API.