Go to file
Patrick Westerhoff 06c93669d6 Allow overwriting parameters on challenge requests
Add a way to overwrite query arguments that are passed as part of the
challenge request to the external authentication provider in OAuth-based
authentication providers, including OpenID Connect.

This uses the new `AuthenticationProperties.Parameters` collection to
pass parameters to the authentication handler which will then look for
special items within that property bag, overwriting previously
configured values within the authentication options.

This can be used for example to overwrite the OAuth scopes that are
requested from an authentication provider, or to explicitly trigger a
reauthentication by requiring a login prompt with OpenID Connect. By
being able to specify this on individual challenge requests (using
`HttpContext.ChallengeAsync`), this is independent from the global
scheme configuration.

Custom ~ChallengeProperties types, e.g. `OAuthChallengeProperties` for
OAuth-based authentication providers, provide assistance in setting the
challenge request parameters but are not required to make the handlers
use the overwritten values.

- Adjust authentication handlers to respect the custom parameters, and
  add ~ChallengeProperties types.
- Introduce `OAuthHandler.FormatScope(IEnumerable<string>)` to format a
  custom set of scopes. Subclasses requiring a different scope format
  should override this method instead of the parameterless overload.
  Overriding just `FormatScope()` will prevent handlers from supporting
  overwriting the OAuth `scope` in a challenge request.
- Refactor GoogleHandler to support parameterization through both the
  `Parameters` and the `Items` collection (former is preferred) to keep
  compatibility with the old behavior.
- Add an OpenIdConnect sample to overwrite the prompt argument in a
  challenge request.
- Add extensive tests.
2018-03-23 02:09:05 +01:00
build Set 2.0 baselines 2018-03-21 11:46:17 -07:00
samples Allow overwriting parameters on challenge requests 2018-03-23 02:09:05 +01:00
shared/Microsoft.AspNetCore.ChunkingCookieManager.Sources Add consent to CookiePolicy #1561 2017-12-27 13:38:18 -08:00
src Allow overwriting parameters on challenge requests 2018-03-23 02:09:05 +01:00
test Allow overwriting parameters on challenge requests 2018-03-23 02:09:05 +01:00
.appveyor.yml Update dependencies.props to 2.1.0-preview-28193, build tools to 2.1.0-preview1-1010 [ci skip] 2018-01-31 15:01:13 -08:00
.gitattributes
.gitignore
.travis.yml Update dependencies.props to 2.1.0-preview-28193, build tools to 2.1.0-preview1-1010 [ci skip] 2018-01-31 15:01:13 -08:00
CONTRIBUTING.md
Directory.Build.props
Directory.Build.targets
LICENSE.txt
NuGet.config
NuGetPackageVerifier.json
README.md
Security.sln #43 Add Microsoft.AspNetCore.Authentication.WsFederation, samples, and tests. 2018-02-26 15:31:39 -08:00
build.cmd
build.sh
korebuild-lock.txt Set 2.0 baselines 2018-03-21 11:46:17 -07:00
korebuild.json Update KoreBuild channel 2018-03-16 12:33:48 -07:00
run.cmd
run.ps1
run.sh
version.props Prepend FeatureBranchVersionPrefix if FeatureBranchVersionSuffix is specified 2018-03-06 10:06:01 -08:00

README.md

ASP.NET Security

AppVeyor: AppVeyor

Travis: Travis

Contains the security and authorization middlewares for ASP.NET Core.

A list of community projects related to authentication and security for ASP.NET Core are listed in the documentation.

Notes

ASP.NET Security will not include Basic Authentication middleware due to its potential insecurity and performance problems. If you host under IIS you can enable it via IIS configuration.

This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the Home repo.