Commit Graph

51 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
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
Chris Ross (ASP.NET) dde7671c06 OIDC: Use IdentityModel redirect form generator #1448 2018-01-08 09:23:06 -08:00
Chris Ross (ASP.NET) bd07f8b683 #1353 use a compliant Expires header value for expiration. 2017-10-11 12:40:15 -07:00
Chris Ross (ASP.NET) 0904af8ff3 PR style cleanup 2017-10-09 11:45:51 -07:00
OpenIDAuthority e34a5f8fb8 Add MaxAge to OpenIdConnectOptions
- max_age parameter added to the authentication request if MaxAge is not null
 - throws exception if MaxAge is set to a negative value
 - Fractions of seconds are ignored
 - See http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest for expected behavior

Addresses #1233
2017-10-09 11:45:51 -07:00
Gareth Brading 4a6c74f4f9 Added ability to set prompt parameter in OpenIdConnectOptions (#1401) 2017-09-28 14:03:52 -07:00
Chris R 144ee21696 #1188 Add AuthenticationProperties to HandleRequestResult and RemoteFailureContext 2017-09-27 14:18:42 -07:00
Chris Ross (ASP.NET) 13fdbac48f #942 Add the SignedOutCallbackRedirect event for OIDC 2017-09-22 15:29:15 -07:00
Hao Kung 23da476176 Switch to IOptionsMonitor (#1295) 2017-07-06 13:41:47 -07:00
Chris R 658f4621b1 #1208 Clean up JWT and OIDC issuer handling 2017-07-05 14:44:23 -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
Chris R 200ce72312 Rename PostLogoutRedirectUri to avoid spec confusion 2017-06-13 15:20:54 -07:00
John Luo c523839078 Update default settings for SameSite
- Need Lax policy for social authentication
- Need None policy for OIDC
2017-05-26 12:19:18 -07:00
Hao Kung e940cdb36b AuthZ 2.0 changes + react to Http 2017-05-25 18:29:19 -07:00
John Luo 769da5fd87 Add SameSitePolicy to CookiePolicyMiddleware 2017-05-23 09:55:11 -07:00
Hao Kung 1f5a27e20a Switch to Options Initializer 2017-05-17 14:05:27 -07:00
Hao Kung 99aa3bd35d Auth 2.0 2017-04-19 13:00:03 -07:00
Kévin Chalet 32dd435c6e Add an opt-out DisableTelemetry option in the OpenID Connect middleware (#1140) 2017-03-13 10:02:59 -07:00
Chris R ad425163b2 #969 Make social auth claims mapping more configurable
#1024 Remove OIDC protocol claims
2017-03-01 10:55:30 -08:00
Ryan Brandenburg 96c27fa393 Revert breaking parameter rename 2016-11-08 10:32:46 -08:00
Chris R 415055ebab #1007 Additional id_token validation 2016-11-07 12:33:49 -08:00
Chris R 0c815da523 #903 Ensure redirect uris can be generated 2016-11-04 10:51:03 -07:00
Chris R 2d1c56ce5c #884 Honor OIDC's and Jwt's OnAuthenticationFailed HandleResponse() 2016-10-31 13:48:50 -07:00
Troy Dai e09dd6d0b8 Fix #976: Break claims value in array into multiple claims (#996)
* Break claims value in array into multiple claims

* Review feedback 1
2016-09-29 16:21:26 -07:00
Troy Dai 28932a7795 Log the error inforamtion when redeem auth code 2016-09-23 13:10:17 -07:00
Troy Dai 3a5df89f1c Move a nullref check to base class 2016-08-26 08:56:48 -07:00
Troy Dai a79a0360c1 Update OpenIdConnectHandler 2016-08-26 08:56:48 -07:00
Troy Dai c5509fb594 Minor update in OpenIdConnectHandler and Options
1. Default post sign out uri to the root of the applciation;
2. Throw ArgumentNullException for null context in HandleSignOutAsync;
3. Guard null from Unprotected;
4. Clean up code
2016-08-26 08:56:48 -07:00
Troy Dai 26956c5ce1 Update OIDC signout flow
OIDC signout should return to CallbackPath then locally redirect to AuthProperties.RedirectUri
2016-08-25 15:23:12 -07:00
Derek 6cd46a5c10 Remote auth expiration fix (#893)
Remote auth expiration fix, and move ISystemClock to the base AuthenticationProperties
2016-07-19 15:18:42 -07:00
Kévin Chalet b4342b1604 Replace magic strings by the new constants introduced in IdentityModel 2016-06-17 10:43:24 -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 e299695974 #776 Show some JwtBearer errors in response headers 2016-06-01 07:10:16 -07:00
Chris R d6763bd77c #423 Support distributed sign-out. 2016-05-27 14:51:53 -07:00
Chris R 3f596108aa #690 OIDC & JWT event refactoring. 2016-03-25 10:08:33 -07:00
Kiran Challa 6d4a80e747 [Fixes #532] Replace hard-coded logging event ids with a class of consts 2016-03-24 07:11:53 -07:00
Ajay Bhargav Baaskaran 9dfe4d9699 Enabled xml doc generation 2016-03-04 15:49:20 -08:00
Hao Kung ef6dd41384 SaveTokens in OIDC 2016-03-04 12:55:32 -08:00
Hao Kung ace166fa31 Save tokens in auth properties instead of claims 2016-03-03 12:50:46 -08:00
Chris R 9bbbe535f2 #690 Enable custom OIDC authorization code redemption. 2016-02-19 15:07:25 -08:00
Chris R 34bc9c52e1 #456 Unify OIDC Code/IdToken/Hybride flows. 2016-02-08 12:06:13 -08:00
Kévin Chalet bbcabc0212 Move GenerateCorrelationId and ValidateCorrelationId to RemoteAuthenticationHandler 2016-02-08 11:37:49 -08:00
Chris R 9c41eb958e React to IdentityModel breaking change. 2016-01-26 14:28:49 -08:00
Chris R 38de3d6013 #526 Change from storing expires_in to calculating expires_at. 2016-01-24 18:45:02 -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