Commit Graph

18 Commits

Author SHA1 Message Date
Kévin Chalet 7e14b052ea Add AccessDeniedPath support to the OIDC/OAuth2/Twitter providers (#1887)
* Add AccessDeniedPath support to the OIDC/OAuth2/Twitter providers

* Update the code documentation and remove an unnecessary call to SignOutAsync()

* Introduce a new AccessDenied event and move most of the access denied handling logic to RemoteAuthenticationHandler

* Add ReturnUrlParameter support to RemoteAuthenticationHandler

* Remove AccessDeniedException and introduce RemoteAuthenticationHandler.HandleAccessDeniedErrorAsync()

* Use OriginalPath instead of Request.Path

* Update obsolete code comments

* Add unit tests for the new AccessDenied event

* Allow customizing the access denied path/return URL/return URL parameter from the AccessDenied event
2018-11-15 15:12:42 -08:00
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
Patrick Westerhoff d24fddcf59 Clean up tests
- Make Facebook test server asynchronous to avoid having to
  block for the result.
- Clean up some formatting.
2018-03-23 01:33:50 +01:00
Chris Ross (ASP.NET) 21acbf06e8 Update google auth endpoint to v2 #1307 2018-02-28 10:51:13 -08:00
Hao Kung c0b8be58ba
Add scheme forwarding (authN policies) (#1625) 2018-02-01 14:40:56 -08:00
Hao Kung 72e1cb1385 Add VirtualSchemes 2017-11-06 14:16:57 -08: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
Hao Kung 38d33cfbf2 Fix tests to work with new default 2017-07-07 11:36:58 -07:00
Hao Kung 1c30f33c92 Remove AddXyzAuth extension methods 2017-07-05 13:00:40 -07:00
Hao Kung ff9f145a8e Refactor Events + Add IAuthenticationBuilder 2017-06-29 16:27:03 -07:00
Hao Kung ae3dfcdb32 Remote ConfigureDefaultOptions 2017-06-05 11:34:35 -07:00
Hao Kung e940cdb36b AuthZ 2.0 changes + react to Http 2017-05-25 18:29:19 -07:00
Hao Kung 1f5a27e20a Switch to Options Initializer 2017-05-17 14:05:27 -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