Browse Source

Cache the ProcessAuthenticationContext instance to avoid having to re-authenticate userinfo/revocation/introspection requests

pull/2236/head
Kévin Chalet 5 years ago
parent
commit
93dd3ba0f4
  1. 4
      src/OpenIddict.Server/OpenIddictServerHandlers.Introspection.cs
  2. 4
      src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs
  3. 4
      src/OpenIddict.Server/OpenIddictServerHandlers.Userinfo.cs

4
src/OpenIddict.Server/OpenIddictServerHandlers.Introspection.cs

@ -700,6 +700,10 @@ namespace OpenIddict.Server
var notification = new ProcessAuthenticationContext(context.Transaction);
await _dispatcher.DispatchAsync(notification);
// Store the context object in the transaction so it can be later retrieved by handlers
// that want to access the authentication result without triggering a new authentication flow.
context.Transaction.SetProperty(typeof(ProcessAuthenticationContext).FullName!, notification);
if (notification.IsRequestHandled)
{
context.HandleRequest();

4
src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs

@ -643,6 +643,10 @@ namespace OpenIddict.Server
var notification = new ProcessAuthenticationContext(context.Transaction);
await _dispatcher.DispatchAsync(notification);
// Store the context object in the transaction so it can be later retrieved by handlers
// that want to access the authentication result without triggering a new authentication flow.
context.Transaction.SetProperty(typeof(ProcessAuthenticationContext).FullName!, notification);
if (notification.IsRequestHandled)
{
context.HandleRequest();

4
src/OpenIddict.Server/OpenIddictServerHandlers.Userinfo.cs

@ -380,6 +380,10 @@ namespace OpenIddict.Server
var notification = new ProcessAuthenticationContext(context.Transaction);
await _dispatcher.DispatchAsync(notification);
// Store the context object in the transaction so it can be later retrieved by handlers
// that want to access the authentication result without triggering a new authentication flow.
context.Transaction.SetProperty(typeof(ProcessAuthenticationContext).FullName!, notification);
if (notification.IsRequestHandled)
{
context.HandleRequest();

Loading…
Cancel
Save