-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[API Proposal]: Add AdditionalAuthorizationParameters to OAuthOptions/OpenIdConnectOptions #51250
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
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Thanks for contacting us. We're moving this issue to the |
Note: API below is for historical reference, but final API shape is in a subsequent comment. API Review Notes:
API Approved! namespace Microsoft.AspNetCore.Authentication.OAuth;
public class OAuthOptions : RemoteAuthenticationOptions
{
+ public IDictionary<string, string> AdditionalAuthorizationQueryParameters { get; }
}
namespace Microsoft.AspNetCore.Authentication.OpenIdConnect;
public class OpenIdConnectOptions : RemoteAuthenticationOptions
{
+ public IDictionary<string, string> AdditionalAuthorizationQueryParameters { get; }
} |
@amcasey It turns out that even though these parameters are normally query string parameters, they can be form posts too if you set I still think the doc comments should point out that these parameters are typically part of the redirect query string. You could even encode request parameters as JWTs, but I don't think our stack supports that. |
In light of the info above, dropped "query" from the name. API re-approved. namespace Microsoft.AspNetCore.Authentication.OAuth;
public class OAuthOptions : RemoteAuthenticationOptions
{
+ public IDictionary<string, string> AdditionalAuthorizationParameters { get; }
}
namespace Microsoft.AspNetCore.Authentication.OpenIdConnect;
public class OpenIdConnectOptions : RemoteAuthenticationOptions
{
+ public IDictionary<string, string> AdditionalAuthorizationParameters { get; }
} |
@amcasey I'm interested in taking this one. Would you accept a PR for this issue? |
@Kahbazi Thanks! I believe we would accept a PR, but the relevant reviewers are absent right now, so it might take a little while to get feedback. |
Background and Motivation
Today, there's no easy way to add additional parameters to the OAuth/OIDC authorization request.
With OAuth, we have to override
OAuthHandler<TOptions>.BuildChallengeUrl
as often done in AspNet.Security.OAuth.Providers:With OIDC, we can use
OpenIdConnectEvents.OnRedirectToIdentityProvider
like:More context: #39243 and #39503
Proposed API
We can introduce a simpler and more generic solution for adding additional parameters:
namespace Microsoft.AspNetCore.Authentication.OAuth; public class OAuthOptions : RemoteAuthenticationOptions { + public IDictionary<string, string> AdditionalAuthorizationParameters { get; } = new Dictionary<string, string>(); }
namespace Microsoft.AspNetCore.Authentication.OpenIdConnect; public class OpenIdConnectOptions : RemoteAuthenticationOptions { + public IDictionary<string, string> AdditionalAuthorizationParameters { get; } = new Dictionary<string, string>(); }
Usage Examples
Risks
Nothing I can think about now.
The text was updated successfully, but these errors were encountered: