Commit Graph

52 Commits

Author SHA1 Message Date
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
Chris Ross (ASP.NET) 90064ce9df Add ClaimActions for bulk add and remove. #1609 2018-03-21 16:35:37 -07:00
Chris R 5d802a7988 Add sample for refresh tokens 2017-08-03 15:01:11 -07:00
Chris R 5485846b5c Update IdentityModel versions to latest, fix samples. 2017-07-12 09:56:25 -07:00
Hao Kung ff9f145a8e Refactor Events + Add IAuthenticationBuilder 2017-06-29 16:27:03 -07:00
BrennanConroy b7a5a6044d Fix samples logging (#1205) 2017-05-09 08:57:39 -07:00
Hao Kung 99aa3bd35d Auth 2.0 2017-04-19 13:00:03 -07:00
Nate McMaster 61e7ceba45 React to aspnet/Configuration#594 2017-02-08 17:44:52 -08:00
Chris R 2d1c56ce5c #884 Honor OIDC's and Jwt's OnAuthenticationFailed HandleResponse() 2016-10-31 13:48:50 -07:00
Troy Dai 59a86c17e2 Update OpenIdConnectSample
1. Use bootstrap to enhance the view.
2. Html encoding
3. Improve readability
2016-08-24 14:28:31 -07:00
Troy Dai 6cee57752f Update OpenIdConnectSample
1. Add instruction for OpenIdConnectSample
2. Clear unused using statements
3. Hardcoded server URL in `Program.cs`
2016-07-14 15:25:30 -07:00
Pranav K bffbfc7f9e React to OpenId renames 2016-06-04 18:53:09 -07:00
Kévin Chalet 56dca7e0bc Add a 'sid' check to the OIDC middleware to prevent unsolicited logout when possible 2016-06-02 12:21:17 -07:00
Chris R d6763bd77c #423 Support distributed sign-out. 2016-05-27 14:51:53 -07:00
Chris R 59fc691f41 #667 #801 Handle authorize and forbid for redirecting handlers. 2016-05-23 10:50:50 -07:00
Chris R 8b4b99b168 Clean up samples 2016-05-17 13:36:18 -07:00
John Luo bb7290e9e1 Remove references to UseDefaultConfiguration 2016-04-27 15:28:21 -07:00
John Luo 300b9cd90f Fix typo when migrating to ANCM 2016-04-11 11:48:44 -07:00
John Luo ff536cc868 Move web.config and use ANCM 2016-04-11 10:12:20 -07:00
John Luo babd83cf28 Reacting to Kestrel extensions 2016-03-30 15:51:02 -07:00
Chris R 3f596108aa #690 OIDC & JWT event refactoring. 2016-03-25 10:08:33 -07:00
John Luo a2aa94c424 Reacting to Hosting changes 2016-03-24 11:55:44 -07:00
Chris R 34bc9c52e1 #456 Unify OIDC Code/IdToken/Hybride flows. 2016-02-08 12:06:13 -08:00
Hisham Bin Ateya 1b4ccd0ddf Add 'UseServer' 2016-02-04 17:04:59 -08:00
N. Taylor Mullen c0d587e7c2 Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:35:47 -08:00
Chris R de2cb12f5c OIDC cleanup 2016-01-21 17:14:15 -08:00
John Luo 0f9875df0a Reacting to hosting rename 2016-01-17 17:09:38 -08:00
Chris R 197a2aa3fa React to Hosting API change. 2016-01-12 15:41:35 -08:00
John Luo 417ca6cbe3 Updating to new options pattern 2016-01-08 16:53:31 -08:00
John Luo a041807023 Reacting to new Hosting API 2015-12-18 15:09:41 -08:00
Chris R 965a86e404 #593 Convert samples to use UserSecrets. 2015-12-14 10:46:22 -08:00
Chris R 35b7248734 #455 Remove RedirectUri from OIDC, use CallbackPath. 2015-10-22 14:56:15 -07:00
Chris R f588677bb4 #506 Update to Rc1 IdentityModel, update ValidateUserInfoEndpointResponse. 2015-10-16 12:11:54 -07:00
Hao Kung 409b50269a Add RemoteAuthenticationHandler base/error handling logic 2015-10-14 23:08:43 -07:00
Pranav K 6c529eae7a Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:47 -07:00
Chris R 78cf065b88 #493 Upate to IdentityModel beta8 dependencies. 2015-09-28 18:25:13 -07:00
Hao Kung 081577e4f4 Remove usage IOptions from middleware ctors 2015-09-18 12:24:33 -07:00
Hao Kung e8090a3176 Remove authentication from names, async events 2015-09-14 14:54:51 -07:00
Chris R ebcad24307 #404 Verify state via independent cookie. 2015-09-09 12:16:22 -07:00
Kévin Chalet d9b3ea2a54 Add POST support for OpenID Connect authorization and logout requests 2015-09-01 03:59:50 +02:00
Hao Kung 5a2499eb22 Rename ExternalAuthenticationOptions => Shared 2015-07-16 12:43:03 -07:00
Kévin Chalet 9bb8b61146 Revisit OAuthAuthenticationHandler and add a new SaveTokensAsClaims option 2015-07-01 15:03:54 -07:00
Hao Kung 3a8ea672ea AuthN and AuthZ API changes (Async, Challenge) 2015-06-25 17:19:27 -07:00
Chris Ross 63fc18b945 React to auth feature API changes. 2015-04-24 09:57:49 -07:00
Hao Kung 87c31c5526 Switch to IUrlEncoder, introduce AddAuthentication 2015-04-23 22:49:47 -07:00
Chris Ross 7d6349c81d Fix samples. 2015-04-20 15:59:31 -07:00
Chris Ross 99f3aa197f #118 - Use common cookie header formatters. 2015-04-20 15:16:29 -07:00
Hao Kung 776593ec71 React to hosting changes 2015-03-19 11:04:33 -07:00
Praburaj 6086bb0a62 Fixing the OpenIdConnect sample 2015-03-18 15:04:58 -07:00
Hao Kung 775eb5ece4 Split Security into AuthN/AuthZ
AuthenticationType -> Scheme
Move Active/Passive into AutomaticAuthenticationHandler
Security -> Authorization/Authentication assemblies
401-403 logic
Switch from ClaimsIdentity to ClaimsPrincipal
2015-03-02 15:33:52 -08:00