Commit Graph

14 Commits

Author SHA1 Message Date
Hao Kung 899a3a2e88 Refactor common tests 2018-07-26 14:51:00 -07:00
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
Hao Kung c0b8be58ba
Add scheme forwarding (authN policies) (#1625) 2018-02-01 14:40:56 -08:00
Hao Kung 02cd997e32 Add Validate(scheme) and use for RemoteSignInScheme not self validation 2017-10-10 14:17:07 -07:00
Chris R 144ee21696 #1188 Add AuthenticationProperties to HandleRequestResult and RemoteFailureContext 2017-09-27 14:18:42 -07:00
Hao Kung b9d9418f6d Block SignInScheme = self 2017-09-15 14:22:03 -07:00
Chris R 36d3d97b99 #1319 Add DisplayName overloads 2017-07-13 15:20:24 -07:00
Hao Kung 1c30f33c92 Remove AddXyzAuth extension methods 2017-07-05 13:00:40 -07:00
Nate McMaster 968237d751 Replace configure method on Twitter, RemoteAuthentication, and OpenIdConnect options with CookieBuilder 2017-07-05 09:56:12 -07:00
Hao Kung ff9f145a8e Refactor Events + Add IAuthenticationBuilder 2017-06-29 16:27:03 -07:00
Javier Calvarro Nelson 879f0b7f40 [Fixes #1133] Limit the path on the nonce and correlation id cookies 2017-06-15 11:23:05 -07:00
Nate McMaster bdd4d21996 Update test framework versions and fix issues with tests 2017-05-12 14:30:18 -07:00
Hao Kung 4f20655850 Set DisplayName for auth 2017-04-20 14:19:32 -07:00
Hao Kung 99aa3bd35d Auth 2.0 2017-04-19 13:00:03 -07:00