Commit Graph

11 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) 81fb221d9e Embed OIDC metadata and mock out the backchannel #1686 2018-03-20 12:42:16 -07:00
Pranav K f8711a2da3 Update samples and tests to target netcoreapp2.1 2017-11-13 17:24:59 -08: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
Javier Calvarro Nelson 3e7d1a7fd4 React to updated IdentityModel version 2017-10-06 16:09:26 -07:00
Chris Ross 0c82d94a54 #772 Signout FormPost test (#1358) 2017-08-11 11:50:25 -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
Troy Dai 562eb7054a Merge TestDefaultValues with TestServerBuilder 2016-08-23 09:05:17 -07:00
Troy Dai abc1b37ee1 Update OpenId Connect Challenge Tests
1. Expand the test coverage: add tests covers events work flow.
2. Move OpenID connect challenge tests to their own class.
3. Further refactory the test settings and utilities.
2016-08-23 09:05:17 -07:00