Browse Source

Introduce OpenIddictMessage.Count to allow retrieving the number of parameters contained in a message

pull/780/head
Kévin Chalet 7 years ago
parent
commit
985a9ec191
  1. 5
      src/OpenIddict.Abstractions/Primitives/OpenIddictMessage.cs
  2. 2
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs
  3. 2
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs
  4. 2
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs
  5. 2
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs

5
src/OpenIddict.Abstractions/Primitives/OpenIddictMessage.cs

@ -174,6 +174,11 @@ namespace OpenIddict.Abstractions
set => SetParameter(name, value);
}
/// <summary>
/// Gets the number of parameters contained in the current message.
/// </summary>
public int Count => Parameters.Count;
/// <summary>
/// Gets the dictionary containing the parameters.
/// </summary>

2
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs

@ -200,7 +200,7 @@ namespace OpenIddict.Server.AspNetCore
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the authorization request,
// ignore the following logic to prevent an infinite redirect loop.
if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}

2
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs

@ -198,7 +198,7 @@ namespace OpenIddict.Server.AspNetCore
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the logout request,
// ignore the following logic to prevent an infinite redirect loop.
if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}

2
src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs

@ -197,7 +197,7 @@ namespace OpenIddict.Server.Owin
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the authorization request,
// ignore the following logic to prevent an infinite redirect loop.
if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}

2
src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs

@ -195,7 +195,7 @@ namespace OpenIddict.Server.Owin
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the logout request,
// ignore the following logic to prevent an infinite redirect loop.
if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}

Loading…
Cancel
Save