-
Notifications
You must be signed in to change notification settings - Fork 546
Use AdditionalAuthorizationParameters #848
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
Use AdditionalAuthorizationParameters #848
Conversation
- Ensure that overrides of `BuildChallengeUrl()` that do not call the base implementation add the values from the new `AdditionalAuthorizationParameters` property. - Move all static challenge parameters into the `AdditionalAuthorizationParameters` property on the options. - Remove `BuildChallengeUrl()` overrides, where possible, to just use `AdditionalAuthorizationParameters` instead.
I prefer the old approach: these parameters are actually required for the providers to work correctly so we shouldn't allow users to remove them (which could be accidental, e.g by calling |
src/AspNet.Security.OAuth.Alipay/AlipayAuthenticationHandler.cs
Outdated
Show resolved
Hide resolved
src/AspNet.Security.OAuth.Alipay/AlipayAuthenticationHandler.cs
Outdated
Show resolved
Hide resolved
Didn't consider that, but I did think that it was the more questionable part of the change, hence the review request. I'll undo those parts.
I didn't check the definition so assumed it was get-set. Will remove the
Depends if you want to remove the ability for the user to be "I know what I'm doing" and override one of our parameters with another value for "{insert reason}". Personally I'd favour the "you can override it if you really want to" behaviour. |
- Remove redundant null checks. - Revert changes to move static parameters into `AdditionalAuthorizationParameters`.
👍🏻
I have no strong preference/opinion on that (FWIW, I opted for the second option in OpenIddict), but if we don't use the same logic as If you think allowing users to override the default parameters is the thing to do, maybe we should try to convince the ASP.NET folks the /cc @halter73 |
I usually like to allow users to say "I know what I'm doing" when working on niche APIs, but a lot of people work with The decision to remove the static challenge parameters from the dictionary so they cannot be accidentally cleared shows that you acknowledge that this API will be used by people who don't know what they're doing and therefore don't want to give them any unnecessary footguns. It seems at least as likely that someone would accidently overwrite a default parameter with a bad value. If there is any real "{insert reason}" that you can come up with for overwriting a parameter, I'd reconsider. I'm usually more annoyed by being unnecessarily prevented from doing something than I am by footguns. |
Copy the pattern from `OAuthHandler.BuildChallengeUrl()`. See https://github.com/dotnet/aspnetcore/blob/ec293ee75c0c022370951a459b188fa81ec8b7c3/src/Security/Authentication/OAuth/src/OAuthHandler.cs#L331-L334.
* Update to ASP.NET Core 9 preview 1 - Update to preview 1 of ASP.NET Core 9. - Use xunit's `TheoryData<T>`. - Fix new code analysis warnings and suggestions. - Disable noisy new CA1515 warning. - Update various dependencies to their latest versions. * Update .NET SDK to 9.0.100-preview.2.24157.14 (#842) * Update prerelease iteration Update for preview.2. * Use AdditionalAuthorizationParameters (#848) Ensure that overrides of `BuildChallengeUrl()` that do not call the base implementation add the values from the new `AdditionalAuthorizationParameters` property. See https://github.com/dotnet/aspnetcore/blob/ec293ee75c0c022370951a459b188fa81ec8b7c3/src/Security/Authentication/OAuth/src/OAuthHandler.cs#L331-L334. * Update .NET SDK to 9.0.100-preview.3.24204.13 (#853) * Update .NET SDK Update .NET SDK to version 9.0.100-preview.3.24204.13. --- updated-dependencies: - dependency-name: Microsoft.NET.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: aspnet-contrib-service-account[bot] <161750942+aspnet-contrib-service-account[bot]@users.noreply.github.com> * Bump .NET NuGet packages Bumps .NET dependencies to their latest versions for the .NET 9.0.100-preview.3.24204.13 SDK. Bumps Microsoft.AspNetCore.Authentication.Google from 9.0.0-preview.2.24128.4 to 9.0.0-preview.3.24172.13. Bumps Microsoft.AspNetCore.Mvc.Testing from 9.0.0-preview.2.24128.4 to 9.0.0-preview.3.24172.13. Bumps Microsoft.AspNetCore.TestHost from 9.0.0-preview.2.24128.4 to 9.0.0-preview.3.24172.13. --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Authentication.Google dependency-type: direct:production update-type: version-update:semver-major - dependency-name: Microsoft.AspNetCore.Mvc.Testing dependency-type: direct:production update-type: version-update:semver-major - dependency-name: Microsoft.AspNetCore.TestHost dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: aspnet-contrib-service-account[bot] <161750942+aspnet-contrib-service-account[bot]@users.noreply.github.com> * Update prerelease iteration Update to preview 3. --------- Signed-off-by: aspnet-contrib-service-account[bot] <161750942+aspnet-contrib-service-account[bot]@users.noreply.github.com> Co-authored-by: aspnet-contrib-service-account[bot] <161750942+aspnet-contrib-service-account[bot]@users.noreply.github.com> Co-authored-by: Martin Costello <[email protected]> * Update to ASP.NET Core 9 preview 4 (#879) Update to preview 4 of ASP.NET Core 9. * Update to ASP.NET Core 9 preview 5 (#893) Update to preview 5 of ASP.NET Core 9. * Fix baselines Fix up package validation baselines. * Update baseline Update Docusign baseline for .NET 9. * Update to ASP.NET Core 9 preview 6 Update to preview 6 of ASP.NET Core 9. * Update to ASP.NET Core 9 preview 7 (#928) Update to preview 7 of ASP.NET Core 9. * Update Arcade (#941) - Annual update of .NET Arcade for .NET 9. - Fix new analysis warnings. * Update to .NET 9 RC1 Update to release candidate 1 of ASP.NET Core 9. * Bump System.Text.Encodings.Web Bump transient package reference to fix build. * Update to .NET 9 RC2 Update to release candidate 2 of .NET 9. * Remove unused action Remove unused setup action for NuGet. * Update to .NET 9 GA Update to the stable version of .NET 9. --------- Signed-off-by: aspnet-contrib-service-account[bot] <161750942+aspnet-contrib-service-account[bot]@users.noreply.github.com> Co-authored-by: aspnet-contrib-service-account[bot] <161750942+aspnet-contrib-service-account[bot]@users.noreply.github.com>
Ensure that overrides of
BuildChallengeUrl()
that do not call the base implementation add the values from the newAdditionalAuthorizationParameters
property.