Browse Source

Attach event identifiers to all the log messages

pull/2307/head
Kévin Chalet 9 months ago
parent
commit
2fc7908f93
  1. 10
      src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs
  2. 6
      src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs
  3. 10
      src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs
  4. 2
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs
  5. 2
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Session.cs
  6. 10
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs
  7. 2
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHttpListener.cs
  8. 2
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationPipeListener.cs
  9. 8
      src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs
  10. 10
      src/OpenIddict.Client/OpenIddictClientDispatcher.cs
  11. 6
      src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs
  12. 2
      src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs
  13. 4
      src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs
  14. 2
      src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs
  15. 2
      src/OpenIddict.Client/OpenIddictClientHandlers.Introspection.cs
  16. 16
      src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs
  17. 2
      src/OpenIddict.Client/OpenIddictClientHandlers.Revocation.cs
  18. 4
      src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs
  19. 2
      src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs
  20. 22
      src/OpenIddict.Client/OpenIddictClientHandlers.cs
  21. 32
      src/OpenIddict.Client/OpenIddictClientService.cs
  22. 12
      src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
  23. 6
      src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs
  24. 18
      src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
  25. 6
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs
  26. 2
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs
  27. 4
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs
  28. 28
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs
  29. 6
      src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs
  30. 6
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs
  31. 2
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs
  32. 4
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs
  33. 28
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs
  34. 10
      src/OpenIddict.Server/OpenIddictServerDispatcher.cs
  35. 160
      src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs
  36. 20
      src/OpenIddict.Server/OpenIddictServerHandlers.Device.cs
  37. 20
      src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs
  38. 54
      src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs
  39. 20
      src/OpenIddict.Server/OpenIddictServerHandlers.Introspection.cs
  40. 26
      src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs
  41. 20
      src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs
  42. 18
      src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs
  43. 6
      src/OpenIddict.Server/OpenIddictServerHandlers.Userinfo.cs
  44. 28
      src/OpenIddict.Server/OpenIddictServerHandlers.cs
  45. 2
      src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs
  46. 4
      src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs
  47. 2
      src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs
  48. 8
      src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs
  49. 10
      src/OpenIddict.Validation/OpenIddictValidationDispatcher.cs
  50. 4
      src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs
  51. 2
      src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs
  52. 16
      src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs
  53. 10
      src/OpenIddict.Validation/OpenIddictValidationHandlers.cs
  54. 12
      src/OpenIddict.Validation/OpenIddictValidationService.cs

10
src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs

@ -260,7 +260,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#FormSerialization for more information.
if (string.IsNullOrEmpty(request.ContentType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6138), HeaderNames.ContentType);
context.Logger.LogInformation(6138, SR.GetResourceString(SR.ID6138), HeaderNames.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -273,7 +273,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers
// May have media/type; charset=utf-8, allow partial match.
if (!request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6139), HeaderNames.ContentType, request.ContentType);
context.Logger.LogInformation(6139, SR.GetResourceString(SR.ID6139), HeaderNames.ContentType, request.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -288,7 +288,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -1350,7 +1350,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers
// Don't return the state originally sent by the client application.
context.Transaction.Response.State = null;
context.Logger.LogInformation(SR.GetResourceString(SR.ID6143), context.Transaction.Response);
context.Logger.LogInformation(6143, SR.GetResourceString(SR.ID6143), context.Transaction.Response);
using var stream = new MemoryStream();
using var writer = new StreamWriter(stream);
@ -1409,7 +1409,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers
throw new ArgumentNullException(nameof(context));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6145));
context.Logger.LogInformation(6145, SR.GetResourceString(SR.ID6145));
context.HandleRequest();
return default;

6
src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs

@ -113,7 +113,7 @@ public static partial class OpenIddictClientDataProtectionHandlers
context.Principal = principal;
context.Logger.LogTrace(SR.GetResourceString(SR.ID6152), context.Token, context.Principal.Claims);
context.Logger.LogTrace(6152, SR.GetResourceString(SR.ID6152), context.Token, context.Principal.Claims);
return default;
@ -145,7 +145,7 @@ public static partial class OpenIddictClientDataProtectionHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogTrace(exception, SR.GetResourceString(SR.ID6153), context.Token);
context.Logger.LogTrace(6153, exception, SR.GetResourceString(SR.ID6153), context.Token);
return null;
}
@ -256,7 +256,7 @@ public static partial class OpenIddictClientDataProtectionHandlers
context.Token = Base64UrlEncoder.Encode(protector.Protect(buffer.ToArray()));
context.Logger.LogTrace(SR.GetResourceString(SR.ID6016), context.TokenType,
context.Logger.LogTrace(6016, SR.GetResourceString(SR.ID6016), context.TokenType,
context.Token, context.Principal.Claims);
return default;

10
src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs

@ -266,7 +266,7 @@ public static partial class OpenIddictClientOwinHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#FormSerialization for more information.
if (string.IsNullOrEmpty(request.ContentType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6138), Headers.ContentType);
context.Logger.LogInformation(6138, SR.GetResourceString(SR.ID6138), Headers.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -279,7 +279,7 @@ public static partial class OpenIddictClientOwinHandlers
// May have media/type; charset=utf-8, allow partial match.
if (!request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6139), Headers.ContentType, request.ContentType);
context.Logger.LogInformation(6139, SR.GetResourceString(SR.ID6139), Headers.ContentType, request.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -297,7 +297,7 @@ public static partial class OpenIddictClientOwinHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -1473,7 +1473,7 @@ public static partial class OpenIddictClientOwinHandlers
// Don't return the state originally sent by the client application.
context.Transaction.Response.State = null;
context.Logger.LogInformation(SR.GetResourceString(SR.ID6143), context.Transaction.Response);
context.Logger.LogInformation(6143, SR.GetResourceString(SR.ID6143), context.Transaction.Response);
using var stream = new MemoryStream();
using var writer = new StreamWriter(stream);
@ -1532,7 +1532,7 @@ public static partial class OpenIddictClientOwinHandlers
throw new ArgumentNullException(nameof(context));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6145));
context.Logger.LogInformation(6145, SR.GetResourceString(SR.ID6145));
context.HandleRequest();
return default;

2
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs

@ -182,7 +182,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
catch (NSErrorException exception)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6231));
context.Logger.LogError(6231, exception, SR.GetResourceString(SR.ID6231));
context.Reject(
error: Errors.ServerError,

2
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Session.cs

@ -182,7 +182,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
catch (NSErrorException exception)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6232));
context.Logger.LogError(6232, exception, SR.GetResourceString(SR.ID6232));
context.Reject(
error: Errors.ServerError,

10
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs

@ -391,7 +391,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
// If the incoming request doesn't use GET, reject it.
if (!string.Equals(request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.HttpMethod);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.HttpMethod);
context.Reject(
error: Errors.InvalidRequest,
@ -456,7 +456,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
if (!MediaTypeHeaderValue.TryParse(request.ContentType, out MediaTypeHeaderValue? type) ||
StringSegment.IsNullOrEmpty(type.MediaType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6138), "Content-Type");
context.Logger.LogInformation(6138, SR.GetResourceString(SR.ID6138), "Content-Type");
context.Reject(
error: Errors.InvalidRequest,
@ -468,7 +468,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
if (!StringSegment.Equals(type.MediaType, "application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6139), "Content-Type", request.ContentType);
context.Logger.LogInformation(6139, SR.GetResourceString(SR.ID6139), "Content-Type", request.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -488,7 +488,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.HttpMethod);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.HttpMethod);
context.Reject(
error: Errors.InvalidRequest,
@ -966,7 +966,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6215), identifier);
context.Logger.LogWarning(6215, SR.GetResourceString(SR.ID6215), identifier);
}
// Inform the host that the application should stop and mark the authentication context as handled

2
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHttpListener.cs

@ -249,7 +249,7 @@ public sealed class OpenIddictClientSystemIntegrationHttpListener : BackgroundSe
// Swallow other exceptions to ensure the worker doesn't exit when encountering an exception.
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
logger.LogWarning(exception, SR.GetResourceString(SR.ID6214));
logger.LogWarning(6214, exception, SR.GetResourceString(SR.ID6214));
continue;
}

2
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationPipeListener.cs

@ -122,7 +122,7 @@ public sealed class OpenIddictClientSystemIntegrationPipeListener : BackgroundSe
// Swallow other exceptions to ensure the service doesn't exit when encountering an exception.
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
logger.LogWarning(exception, SR.GetResourceString(SR.ID6213));
logger.LogWarning(6213, exception, SR.GetResourceString(SR.ID6213));
continue;
}

8
src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs

@ -1111,7 +1111,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
// In this case, log the error details and return a generic error to stop processing the event.
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6182));
context.Logger.LogError(6182, exception, SR.GetResourceString(SR.ID6182));
context.Reject(
error: Errors.ServerError,
@ -1368,7 +1368,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
// a server error occurs while the JSON response is being generated and returned to the client.
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6183),
context.Logger.LogError(6183, exception, SR.GetResourceString(SR.ID6183),
await response.Content.ReadAsStringAsync());
context.Reject(
@ -1552,7 +1552,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
// error could be extracted from the payload or from the WWW-Authenticate header.
if (!response.IsSuccessStatusCode && string.IsNullOrEmpty(context.Transaction.Response?.Error))
{
context.Logger.LogError(SR.GetResourceString(SR.ID6184), response.StatusCode,
context.Logger.LogError(6184, SR.GetResourceString(SR.ID6184), response.StatusCode,
await response.Content.ReadAsStringAsync());
context.Reject(
@ -1576,7 +1576,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
// (e.g because an unsupported content type was returned), return a generic error.
if (context.Transaction.Response is null)
{
context.Logger.LogError(SR.GetResourceString(SR.ID6185), response.StatusCode,
context.Logger.LogError(6185, SR.GetResourceString(SR.ID6185), response.StatusCode,
response.Content.Headers.ContentType, await response.Content.ReadAsStringAsync());
context.Reject(

10
src/OpenIddict.Client/OpenIddictClientDispatcher.cs

@ -51,14 +51,14 @@ public sealed class OpenIddictClientDispatcher : IOpenIddictClientDispatcher
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && _logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(exception, SR.GetResourceString(SR.ID6132), handler.GetType().FullName, typeof(TContext).FullName);
_logger.LogDebug(6132, exception, SR.GetResourceString(SR.ID6132), handler.GetType().FullName, typeof(TContext).FullName);
throw;
}
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6133), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6133, SR.GetResourceString(SR.ID6133), typeof(TContext).FullName, handler.GetType().FullName);
}
switch (context)
@ -66,21 +66,21 @@ public sealed class OpenIddictClientDispatcher : IOpenIddictClientDispatcher
case BaseRequestContext { IsRequestHandled: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6134), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6134, SR.GetResourceString(SR.ID6134), typeof(TContext).FullName, handler.GetType().FullName);
}
return;
case BaseRequestContext { IsRequestSkipped: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6135), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6135, SR.GetResourceString(SR.ID6135), typeof(TContext).FullName, handler.GetType().FullName);
}
return;
case BaseValidatingContext { IsRejected: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6136), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6136, SR.GetResourceString(SR.ID6136), typeof(TContext).FullName, handler.GetType().FullName);
}
return;

6
src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs

@ -293,7 +293,7 @@ public static partial class OpenIddictClientHandlers
// For more information, see https://www.rfc-editor.org/rfc/rfc8628#section-3.2.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6234), context.Response);
context.Logger.LogInformation(6234, SR.GetResourceString(SR.ID6234), context.Response);
context.Reject(
error: context.Response.Error switch
@ -464,7 +464,7 @@ public static partial class OpenIddictClientHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0302));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6178), notification.Request);
context.Logger.LogInformation(6178, SR.GetResourceString(SR.ID6178), notification.Request);
}
}
@ -521,7 +521,7 @@ public static partial class OpenIddictClientHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6179));
context.Logger.LogInformation(6179, SR.GetResourceString(SR.ID6179));
}
}

2
src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs

@ -122,7 +122,7 @@ public static partial class OpenIddictClientHandlers
// For more information, see https://www.rfc-editor.org/rfc/rfc8628#section-3.2.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6216), context.Response);
context.Logger.LogInformation(6216, SR.GetResourceString(SR.ID6216), context.Response);
context.Reject(
error: context.Response.Error switch

4
src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs

@ -184,7 +184,7 @@ public static partial class OpenIddictClientHandlers
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6203), context.Response);
context.Logger.LogInformation(6203, SR.GetResourceString(SR.ID6203), context.Response);
context.Reject(
error: Errors.ServerError,
@ -1434,7 +1434,7 @@ public static partial class OpenIddictClientHandlers
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6204), context.Response);
context.Logger.LogInformation(6204, SR.GetResourceString(SR.ID6204), context.Response);
context.Reject(
error: Errors.ServerError,

2
src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs

@ -114,7 +114,7 @@ public static partial class OpenIddictClientHandlers
// For more information, see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6206), context.Response);
context.Logger.LogInformation(6206, SR.GetResourceString(SR.ID6206), context.Response);
context.Reject(
error: context.Response.Error switch

2
src/OpenIddict.Client/OpenIddictClientHandlers.Introspection.cs

@ -138,7 +138,7 @@ public static partial class OpenIddictClientHandlers
// For more information, see https://datatracker.ietf.org/doc/html/rfc7662#section-2.3.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6205), context.Response);
context.Logger.LogInformation(6205, SR.GetResourceString(SR.ID6205), context.Response);
context.Reject(
error: context.Response.Error switch

16
src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs

@ -369,7 +369,7 @@ public static partial class OpenIddictClientHandlers
context.Registration.ConfigurationManager.RequestRefresh();
}
context.Logger.LogTrace(result.Exception, SR.GetResourceString(SR.ID6000), context.Token);
context.Logger.LogTrace(6000, result.Exception, SR.GetResourceString(SR.ID6000), context.Token);
context.Reject(
error: Errors.InvalidToken,
@ -470,7 +470,7 @@ public static partial class OpenIddictClientHandlers
// Store the resolved signing algorithm from the token and attach it to the principal.
context.Principal.SetClaim(Claims.Private.SigningAlgorithm, token.Alg);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6001), context.Token, context.Principal.Claims);
context.Logger.LogTrace(6001, SR.GetResourceString(SR.ID6001), context.Token, context.Principal.Claims);
}
}
@ -739,7 +739,7 @@ public static partial class OpenIddictClientHandlers
if (await _tokenManager.HasStatusAsync(token, Statuses.Redeemed))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6002), context.TokenId);
context.Logger.LogInformation(6002, SR.GetResourceString(SR.ID6002), context.TokenId);
context.Reject(
error: Errors.InvalidToken,
@ -761,7 +761,7 @@ public static partial class OpenIddictClientHandlers
if (!await _tokenManager.HasStatusAsync(token, Statuses.Valid))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6005), context.TokenId);
context.Logger.LogInformation(6005, SR.GetResourceString(SR.ID6005), context.TokenId);
context.Reject(
error: Errors.InvalidToken,
@ -877,7 +877,7 @@ public static partial class OpenIddictClientHandlers
// Attach the token identifier to the principal so that it can be stored in the token.
context.Principal.SetTokenId(identifier);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6012), context.TokenType, identifier);
context.Logger.LogTrace(6012, SR.GetResourceString(SR.ID6012), context.TokenType, identifier);
}
}
@ -1025,7 +1025,7 @@ public static partial class OpenIddictClientHandlers
context.Token = context.SecurityTokenHandler.CreateToken(context.SecurityTokenDescriptor);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6013), context.TokenType,
context.Logger.LogTrace(6013, SR.GetResourceString(SR.ID6013), context.TokenType,
context.Token, context.SecurityTokenDescriptor.Subject?.Claims ?? []);
return default;
@ -1088,13 +1088,13 @@ public static partial class OpenIddictClientHandlers
await _tokenManager.UpdateAsync(token, descriptor);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6014), context.Token, identifier, context.TokenType);
context.Logger.LogTrace(6014, SR.GetResourceString(SR.ID6014), context.Token, identifier, context.TokenType);
// Replace the returned token by the reference identifier, if applicable.
if (context.IsReferenceToken)
{
context.Token = descriptor.ReferenceId;
context.Logger.LogTrace(SR.GetResourceString(SR.ID6015), descriptor.ReferenceId, identifier, context.TokenType);
context.Logger.LogTrace(6015, SR.GetResourceString(SR.ID6015), descriptor.ReferenceId, identifier, context.TokenType);
}
}
}

2
src/OpenIddict.Client/OpenIddictClientHandlers.Revocation.cs

@ -105,7 +105,7 @@ public static partial class OpenIddictClientHandlers
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6230), context.Response);
context.Logger.LogInformation(6230, SR.GetResourceString(SR.ID6230), context.Response);
context.Reject(
error: context.Response.Error switch

4
src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs

@ -243,7 +243,7 @@ public static partial class OpenIddictClientHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0369));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6199), notification.Request);
context.Logger.LogInformation(6199, SR.GetResourceString(SR.ID6199), notification.Request);
}
}
@ -300,7 +300,7 @@ public static partial class OpenIddictClientHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6200));
context.Logger.LogInformation(6200, SR.GetResourceString(SR.ID6200));
}
}

2
src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs

@ -118,7 +118,7 @@ public static partial class OpenIddictClientHandlers
// For more information, see https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6207), context.Response);
context.Logger.LogInformation(6207, SR.GetResourceString(SR.ID6207), context.Response);
context.Reject(
error: context.Response.Error switch

22
src/OpenIddict.Client/OpenIddictClientHandlers.cs

@ -504,7 +504,7 @@ public static partial class OpenIddictClientHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) &&
exception is not OperationCanceledException)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219));
context.Logger.LogError(6219, exception, SR.GetResourceString(SR.ID6219));
context.Reject(
error: Errors.ServerError,
@ -961,7 +961,7 @@ public static partial class OpenIddictClientHandlers
left: MemoryMarshal.AsBytes(comparand.AsSpan()),
right: MemoryMarshal.AsBytes(context.RequestForgeryProtection.AsSpan())))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6209));
context.Logger.LogWarning(6209, SR.GetResourceString(SR.ID6209));
context.Reject(
error: Errors.InvalidRequest,
@ -1151,7 +1151,7 @@ public static partial class OpenIddictClientHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) &&
exception is not OperationCanceledException)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219));
context.Logger.LogError(6219, exception, SR.GetResourceString(SR.ID6219));
context.Reject(
error: Errors.ServerError,
@ -1288,7 +1288,7 @@ public static partial class OpenIddictClientHandlers
var error = (string?) context.Request[Parameters.Error];
if (!string.IsNullOrEmpty(error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6208), context.Request);
context.Logger.LogInformation(6208, SR.GetResourceString(SR.ID6208), context.Request);
context.Reject(
error: error switch
@ -1969,7 +1969,7 @@ public static partial class OpenIddictClientHandlers
left: MemoryMarshal.AsBytes(left.AsSpan()), // The nonce in the identity token is already hashed.
right: MemoryMarshal.AsBytes(Base64UrlEncoder.Encode(
OpenIddictHelpers.ComputeSha256Hash(Encoding.UTF8.GetBytes(right))).AsSpan())):
context.Logger.LogWarning(SR.GetResourceString(SR.ID6210));
context.Logger.LogWarning(6210, SR.GetResourceString(SR.ID6210));
context.Reject(
error: Errors.InvalidRequest,
@ -3405,7 +3405,7 @@ public static partial class OpenIddictClientHandlers
left: MemoryMarshal.AsBytes(left.AsSpan()), // The nonce in the identity token is already hashed.
right: MemoryMarshal.AsBytes(Base64UrlEncoder.Encode(
OpenIddictHelpers.ComputeSha256Hash(Encoding.UTF8.GetBytes(right))).AsSpan())):
context.Logger.LogWarning(SR.GetResourceString(SR.ID6211));
context.Logger.LogWarning(6211, SR.GetResourceString(SR.ID6211));
context.Reject(
error: Errors.InvalidRequest,
@ -4583,7 +4583,7 @@ public static partial class OpenIddictClientHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) &&
exception is not OperationCanceledException)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219));
context.Logger.LogError(6219, exception, SR.GetResourceString(SR.ID6219));
context.Reject(
error: Errors.ServerError,
@ -6801,7 +6801,7 @@ public static partial class OpenIddictClientHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) &&
exception is not OperationCanceledException)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219));
context.Logger.LogError(6219, exception, SR.GetResourceString(SR.ID6219));
context.Reject(
error: Errors.ServerError,
@ -7292,7 +7292,7 @@ public static partial class OpenIddictClientHandlers
.SetClaim(Claims.Private.RegistrationId, context.Registration.RegistrationId)
.SetClaim(Claims.Private.ProviderName, context.Registration.ProviderName);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6154), context.Token, context.Principal.Claims);
context.Logger.LogTrace(6154, SR.GetResourceString(SR.ID6154), context.Token, context.Principal.Claims);
}
}
@ -7472,7 +7472,7 @@ public static partial class OpenIddictClientHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) &&
exception is not OperationCanceledException)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219));
context.Logger.LogError(6219, exception, SR.GetResourceString(SR.ID6219));
context.Reject(
error: Errors.ServerError,
@ -8142,7 +8142,7 @@ public static partial class OpenIddictClientHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) &&
exception is not OperationCanceledException)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219));
context.Logger.LogError(6219, exception, SR.GetResourceString(SR.ID6219));
context.Reject(
error: Errors.ServerError,

32
src/OpenIddict.Client/OpenIddictClientService.cs

@ -1118,7 +1118,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6186), context.RemoteUri, context.Request);
context.Logger.LogInformation(6186, SR.GetResourceString(SR.ID6186), context.RemoteUri, context.Request);
return context.Request;
}
@ -1144,7 +1144,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6187), context.RemoteUri, context.Response);
context.Logger.LogInformation(6187, SR.GetResourceString(SR.ID6187), context.RemoteUri, context.Response);
return context.Response;
}
@ -1325,7 +1325,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6188), context.RemoteUri, context.Request);
context.Logger.LogInformation(6188, SR.GetResourceString(SR.ID6188), context.RemoteUri, context.Request);
return context.Request;
}
@ -1351,7 +1351,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6189), context.RemoteUri, context.Response);
context.Logger.LogInformation(6189, SR.GetResourceString(SR.ID6189), context.RemoteUri, context.Response);
return context.Response;
}
@ -1481,7 +1481,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6217), context.RemoteUri, context.Request);
context.Logger.LogInformation(6217, SR.GetResourceString(SR.ID6217), context.RemoteUri, context.Request);
return context.Request;
}
@ -1508,7 +1508,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6218), context.RemoteUri, context.Response);
context.Logger.LogInformation(6218, SR.GetResourceString(SR.ID6218), context.RemoteUri, context.Response);
return context.Response;
}
@ -1634,7 +1634,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
context.Logger.LogInformation(6192, SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
return context.Request;
}
@ -1661,7 +1661,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
context.Logger.LogInformation(6193, SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
return context.Response;
}
@ -1794,7 +1794,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6235), context.RemoteUri, context.Request);
context.Logger.LogInformation(6235, SR.GetResourceString(SR.ID6235), context.RemoteUri, context.Request);
return context.Request;
}
@ -1821,7 +1821,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6236), context.RemoteUri, context.Response);
context.Logger.LogInformation(6236, SR.GetResourceString(SR.ID6236), context.RemoteUri, context.Response);
return context.Response;
}
@ -1947,7 +1947,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
context.Logger.LogInformation(6192, SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
return context.Request;
}
@ -1974,7 +1974,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
context.Logger.LogInformation(6193, SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
return context.Response;
}
@ -2105,7 +2105,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
context.Logger.LogInformation(6192, SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
return context.Request;
}
@ -2132,7 +2132,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
context.Logger.LogInformation(6193, SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
return context.Response;
}
@ -2259,7 +2259,7 @@ public class OpenIddictClientService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6194), context.RemoteUri, context.Request);
context.Logger.LogInformation(6194, SR.GetResourceString(SR.ID6194), context.RemoteUri, context.Request);
return context.Request;
}
@ -2286,7 +2286,7 @@ public class OpenIddictClientService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6195), context.RemoteUri, context.Response);
context.Logger.LogInformation(6195, SR.GetResourceString(SR.ID6195), context.RemoteUri, context.Response);
return (context.Response, context.UserInfoToken);
}

12
src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs

@ -1397,7 +1397,7 @@ public class OpenIddictApplicationManager<TApplication> : IOpenIddictApplication
if (await HasClientTypeAsync(application, ClientTypes.Public, cancellationToken))
{
Logger.LogWarning(SR.GetResourceString(SR.ID6159));
Logger.LogWarning(6159, SR.GetResourceString(SR.ID6159));
return false;
}
@ -1405,14 +1405,14 @@ public class OpenIddictApplicationManager<TApplication> : IOpenIddictApplication
var value = await Store.GetClientSecretAsync(application, cancellationToken);
if (string.IsNullOrEmpty(value))
{
Logger.LogInformation(SR.GetResourceString(SR.ID6160), await GetClientIdAsync(application, cancellationToken));
Logger.LogInformation(6160, SR.GetResourceString(SR.ID6160), await GetClientIdAsync(application, cancellationToken));
return false;
}
if (!await ValidateClientSecretAsync(secret, value, cancellationToken))
{
Logger.LogInformation(SR.GetResourceString(SR.ID6161), await GetClientIdAsync(application, cancellationToken));
Logger.LogInformation(6161, SR.GetResourceString(SR.ID6161), await GetClientIdAsync(application, cancellationToken));
return false;
}
@ -1487,7 +1487,7 @@ public class OpenIddictApplicationManager<TApplication> : IOpenIddictApplication
}
}
Logger.LogInformation(SR.GetResourceString(SR.ID6202), uri, await GetClientIdAsync(application, cancellationToken));
Logger.LogInformation(6202, SR.GetResourceString(SR.ID6202), uri, await GetClientIdAsync(application, cancellationToken));
return false;
}
@ -1560,7 +1560,7 @@ public class OpenIddictApplicationManager<TApplication> : IOpenIddictApplication
}
}
Logger.LogInformation(SR.GetResourceString(SR.ID6162), uri, await GetClientIdAsync(application, cancellationToken));
Logger.LogInformation(6162, SR.GetResourceString(SR.ID6162), uri, await GetClientIdAsync(application, cancellationToken));
return false;
}
@ -1658,7 +1658,7 @@ public class OpenIddictApplicationManager<TApplication> : IOpenIddictApplication
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
Logger.LogWarning(exception, SR.GetResourceString(SR.ID6163));
Logger.LogWarning(6163, exception, SR.GetResourceString(SR.ID6163));
return new(false);
}

6
src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs

@ -914,21 +914,21 @@ public class OpenIddictAuthorizationManager<TAuthorization> : IOpenIddictAuthori
{
await UpdateAsync(authorization, cancellationToken);
Logger.LogInformation(SR.GetResourceString(SR.ID6164), await Store.GetIdAsync(authorization, cancellationToken));
Logger.LogInformation(6164, SR.GetResourceString(SR.ID6164), await Store.GetIdAsync(authorization, cancellationToken));
return true;
}
catch (ConcurrencyException exception)
{
Logger.LogDebug(exception, SR.GetResourceString(SR.ID6165), await Store.GetIdAsync(authorization, cancellationToken));
Logger.LogDebug(6165, exception, SR.GetResourceString(SR.ID6165), await Store.GetIdAsync(authorization, cancellationToken));
return false;
}
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
Logger.LogWarning(exception, SR.GetResourceString(SR.ID6166), await Store.GetIdAsync(authorization, cancellationToken));
Logger.LogWarning(6166, exception, SR.GetResourceString(SR.ID6166), await Store.GetIdAsync(authorization, cancellationToken));
return false;
}

18
src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs

@ -1041,21 +1041,21 @@ public class OpenIddictTokenManager<TToken> : IOpenIddictTokenManager where TTok
{
await UpdateAsync(token, cancellationToken);
Logger.LogInformation(SR.GetResourceString(SR.ID6168), await Store.GetIdAsync(token, cancellationToken));
Logger.LogInformation(6168, SR.GetResourceString(SR.ID6168), await Store.GetIdAsync(token, cancellationToken));
return true;
}
catch (ConcurrencyException exception)
{
Logger.LogDebug(exception, SR.GetResourceString(SR.ID6169), await Store.GetIdAsync(token, cancellationToken));
Logger.LogDebug(6169, exception, SR.GetResourceString(SR.ID6169), await Store.GetIdAsync(token, cancellationToken));
return false;
}
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
Logger.LogWarning(exception, SR.GetResourceString(SR.ID6170), await Store.GetIdAsync(token, cancellationToken));
Logger.LogWarning(6170, exception, SR.GetResourceString(SR.ID6170), await Store.GetIdAsync(token, cancellationToken));
return false;
}
@ -1080,21 +1080,21 @@ public class OpenIddictTokenManager<TToken> : IOpenIddictTokenManager where TTok
{
await UpdateAsync(token, cancellationToken);
Logger.LogInformation(SR.GetResourceString(SR.ID6171), await Store.GetIdAsync(token, cancellationToken));
Logger.LogInformation(6171, SR.GetResourceString(SR.ID6171), await Store.GetIdAsync(token, cancellationToken));
return true;
}
catch (ConcurrencyException exception)
{
Logger.LogDebug(exception, SR.GetResourceString(SR.ID6172), await Store.GetIdAsync(token, cancellationToken));
Logger.LogDebug(6172, exception, SR.GetResourceString(SR.ID6172), await Store.GetIdAsync(token, cancellationToken));
return false;
}
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
Logger.LogWarning(exception, SR.GetResourceString(SR.ID6173), await Store.GetIdAsync(token, cancellationToken));
Logger.LogWarning(6173, exception, SR.GetResourceString(SR.ID6173), await Store.GetIdAsync(token, cancellationToken));
return false;
}
@ -1119,21 +1119,21 @@ public class OpenIddictTokenManager<TToken> : IOpenIddictTokenManager where TTok
{
await UpdateAsync(token, cancellationToken);
Logger.LogInformation(SR.GetResourceString(SR.ID6174), await Store.GetIdAsync(token, cancellationToken));
Logger.LogInformation(6174, SR.GetResourceString(SR.ID6174), await Store.GetIdAsync(token, cancellationToken));
return true;
}
catch (ConcurrencyException exception)
{
Logger.LogDebug(exception, SR.GetResourceString(SR.ID6175), await Store.GetIdAsync(token, cancellationToken));
Logger.LogDebug(6175, exception, SR.GetResourceString(SR.ID6175), await Store.GetIdAsync(token, cancellationToken));
return false;
}
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
Logger.LogWarning(exception, SR.GetResourceString(SR.ID6176), await Store.GetIdAsync(token, cancellationToken));
Logger.LogWarning(6176, exception, SR.GetResourceString(SR.ID6176), await Store.GetIdAsync(token, cancellationToken));
return false;
}

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

@ -169,7 +169,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6147), context.RedirectUri, context.Response);
context.Logger.LogInformation(6147, SR.GetResourceString(SR.ID6147), context.RedirectUri, context.Response);
using var buffer = new MemoryStream();
using var writer = new StreamWriter(buffer);
@ -255,7 +255,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6148), context.RedirectUri, context.Response);
context.Logger.LogInformation(6148, SR.GetResourceString(SR.ID6148), context.RedirectUri, context.Response);
// Note: while initially not allowed by the core OAuth 2.0 specification, multiple parameters
// with the same name are used by derived drafts like the OAuth 2.0 token exchange specification.
@ -326,7 +326,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6149), context.RedirectUri, context.Response);
context.Logger.LogInformation(6149, SR.GetResourceString(SR.ID6149), context.RedirectUri, context.Response);
var builder = new StringBuilder(context.RedirectUri);

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

@ -97,7 +97,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
{
response.Redirect(properties.RedirectUri);
context.Logger.LogInformation(SR.GetResourceString(SR.ID6144));
context.Logger.LogInformation(6144, SR.GetResourceString(SR.ID6144));
context.HandleRequest();
}

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

@ -145,7 +145,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6151), context.PostLogoutRedirectUri, context.Response);
context.Logger.LogInformation(6151, SR.GetResourceString(SR.ID6151), context.PostLogoutRedirectUri, context.Response);
// Note: while initially not allowed by the core OAuth 2.0 specification, multiple parameters
// with the same name are used by derived drafts like the OAuth 2.0 token exchange specification.
@ -223,7 +223,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
{
response.Redirect(properties.RedirectUri);
context.Logger.LogInformation(SR.GetResourceString(SR.ID6144));
context.Logger.LogInformation(6144, SR.GetResourceString(SR.ID6144));
context.HandleRequest();
}

28
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs

@ -469,7 +469,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -523,7 +523,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#FormSerialization for more information.
if (string.IsNullOrEmpty(request.ContentType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6138), HeaderNames.ContentType);
context.Logger.LogInformation(6138, SR.GetResourceString(SR.ID6138), HeaderNames.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -536,7 +536,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
// May have media/type; charset=utf-8, allow partial match.
if (!request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6139), HeaderNames.ContentType, request.ContentType);
context.Logger.LogInformation(6139, SR.GetResourceString(SR.ID6139), HeaderNames.ContentType, request.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -551,7 +551,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -598,7 +598,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#FormSerialization for more information.
if (string.IsNullOrEmpty(request.ContentType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6138), HeaderNames.ContentType);
context.Logger.LogInformation(6138, SR.GetResourceString(SR.ID6138), HeaderNames.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -611,7 +611,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
// May have media/type; charset=utf-8, allow partial match.
if (!request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6139), HeaderNames.ContentType, request.ContentType);
context.Logger.LogInformation(6139, SR.GetResourceString(SR.ID6139), HeaderNames.ContentType, request.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -626,7 +626,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -675,7 +675,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
if (!string.IsNullOrEmpty(context.Transaction.Request.ClientSecret) &&
!context.Options.ClientAuthenticationMethods.Contains(ClientAuthenticationMethods.ClientSecretPost))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6227), ClientAuthenticationMethods.ClientSecretPost);
context.Logger.LogInformation(6227, SR.GetResourceString(SR.ID6227), ClientAuthenticationMethods.ClientSecretPost);
context.Reject(
error: Errors.InvalidClient,
@ -693,7 +693,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
if (!string.IsNullOrEmpty(header) && header.StartsWith("Basic ", StringComparison.OrdinalIgnoreCase) &&
!context.Options.ClientAuthenticationMethods.Contains(ClientAuthenticationMethods.ClientSecretBasic))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6227), ClientAuthenticationMethods.ClientSecretBasic);
context.Logger.LogInformation(6227, SR.GetResourceString(SR.ID6227), ClientAuthenticationMethods.ClientSecretBasic);
context.Reject(
error: Errors.InvalidClient,
@ -751,7 +751,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
if (!string.IsNullOrEmpty(context.Transaction.Request.ClientAssertion) ||
!string.IsNullOrEmpty(context.Transaction.Request.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6140));
context.Logger.LogInformation(6140, SR.GetResourceString(SR.ID6140));
context.Reject(
error: Errors.InvalidRequest,
@ -1168,7 +1168,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.Logger.LogInformation(6141, SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.HandleRequest();
return default;
@ -1212,7 +1212,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
var response = context.Transaction.GetHttpRequest()?.HttpContext.Response ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0114));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6142), context.Transaction.Response);
context.Logger.LogInformation(6142, SR.GetResourceString(SR.ID6142), context.Transaction.Response);
using var stream = new MemoryStream();
using var writer = new Utf8JsonWriter(stream, new JsonWriterOptions
@ -1375,7 +1375,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
// Don't return the state originally sent by the client application.
context.Transaction.Response.State = null;
context.Logger.LogInformation(SR.GetResourceString(SR.ID6143), context.Transaction.Response);
context.Logger.LogInformation(6143, SR.GetResourceString(SR.ID6143), context.Transaction.Response);
using var stream = new MemoryStream();
using var writer = new StreamWriter(stream);
@ -1434,7 +1434,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
throw new ArgumentNullException(nameof(context));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6145));
context.Logger.LogInformation(6145, SR.GetResourceString(SR.ID6145));
context.HandleRequest();
return default;

6
src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs

@ -182,7 +182,7 @@ public static partial class OpenIddictServerDataProtectionHandlers
context.Principal = principal;
context.Logger.LogTrace(SR.GetResourceString(SR.ID6152), context.Token, context.Principal.Claims);
context.Logger.LogTrace(6152, SR.GetResourceString(SR.ID6152), context.Token, context.Principal.Claims);
return default;
@ -239,7 +239,7 @@ public static partial class OpenIddictServerDataProtectionHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogTrace(exception, SR.GetResourceString(SR.ID6153), context.Token);
context.Logger.LogTrace(6153, exception, SR.GetResourceString(SR.ID6153), context.Token);
return null;
}
@ -390,7 +390,7 @@ public static partial class OpenIddictServerDataProtectionHandlers
context.Token = Base64UrlEncoder.Encode(protector.Protect(buffer.ToArray()));
context.Logger.LogTrace(SR.GetResourceString(SR.ID6016), context.TokenType,
context.Logger.LogTrace(6016, SR.GetResourceString(SR.ID6016), context.TokenType,
context.Token, context.Principal.Claims);
return default;

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

@ -161,7 +161,7 @@ public static partial class OpenIddictServerOwinHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6147), context.RedirectUri, context.Response);
context.Logger.LogInformation(6147, SR.GetResourceString(SR.ID6147), context.RedirectUri, context.Response);
using var buffer = new MemoryStream();
using var writer = new StreamWriter(buffer);
@ -247,7 +247,7 @@ public static partial class OpenIddictServerOwinHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6148), context.RedirectUri, context.Response);
context.Logger.LogInformation(6148, SR.GetResourceString(SR.ID6148), context.RedirectUri, context.Response);
var location = context.RedirectUri;
@ -308,7 +308,7 @@ public static partial class OpenIddictServerOwinHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6149), context.RedirectUri, context.Response);
context.Logger.LogInformation(6149, SR.GetResourceString(SR.ID6149), context.RedirectUri, context.Response);
var builder = new StringBuilder(context.RedirectUri);

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

@ -100,7 +100,7 @@ public static partial class OpenIddictServerOwinHandlers
{
response.Redirect(properties.RedirectUri);
context.Logger.LogInformation(SR.GetResourceString(SR.ID6144));
context.Logger.LogInformation(6144, SR.GetResourceString(SR.ID6144));
context.HandleRequest();
}

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

@ -134,7 +134,7 @@ public static partial class OpenIddictServerOwinHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6151), context.PostLogoutRedirectUri, context.Response);
context.Logger.LogInformation(6151, SR.GetResourceString(SR.ID6151), context.PostLogoutRedirectUri, context.Response);
var location = context.PostLogoutRedirectUri;
@ -202,7 +202,7 @@ public static partial class OpenIddictServerOwinHandlers
{
response.Redirect(properties.RedirectUri);
context.Logger.LogInformation(SR.GetResourceString(SR.ID6144));
context.Logger.LogInformation(6144, SR.GetResourceString(SR.ID6144));
context.HandleRequest();
}

28
src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs

@ -522,7 +522,7 @@ public static partial class OpenIddictServerOwinHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -579,7 +579,7 @@ public static partial class OpenIddictServerOwinHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#FormSerialization for more information.
if (string.IsNullOrEmpty(request.ContentType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6138), Headers.ContentType);
context.Logger.LogInformation(6138, SR.GetResourceString(SR.ID6138), Headers.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -592,7 +592,7 @@ public static partial class OpenIddictServerOwinHandlers
// May have media/type; charset=utf-8, allow partial match.
if (!request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6139), Headers.ContentType, request.ContentType);
context.Logger.LogInformation(6139, SR.GetResourceString(SR.ID6139), Headers.ContentType, request.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -610,7 +610,7 @@ public static partial class OpenIddictServerOwinHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -657,7 +657,7 @@ public static partial class OpenIddictServerOwinHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#FormSerialization for more information.
if (string.IsNullOrEmpty(request.ContentType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6138), Headers.ContentType);
context.Logger.LogInformation(6138, SR.GetResourceString(SR.ID6138), Headers.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -670,7 +670,7 @@ public static partial class OpenIddictServerOwinHandlers
// May have media/type; charset=utf-8, allow partial match.
if (!request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6139), Headers.ContentType, request.ContentType);
context.Logger.LogInformation(6139, SR.GetResourceString(SR.ID6139), Headers.ContentType, request.ContentType);
context.Reject(
error: Errors.InvalidRequest,
@ -688,7 +688,7 @@ public static partial class OpenIddictServerOwinHandlers
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6137), request.Method);
context.Logger.LogInformation(6137, SR.GetResourceString(SR.ID6137), request.Method);
context.Reject(
error: Errors.InvalidRequest,
@ -737,7 +737,7 @@ public static partial class OpenIddictServerOwinHandlers
if (!string.IsNullOrEmpty(context.Transaction.Request.ClientSecret) &&
!context.Options.ClientAuthenticationMethods.Contains(ClientAuthenticationMethods.ClientSecretPost))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6227), ClientAuthenticationMethods.ClientSecretPost);
context.Logger.LogInformation(6227, SR.GetResourceString(SR.ID6227), ClientAuthenticationMethods.ClientSecretPost);
context.Reject(
error: Errors.InvalidClient,
@ -752,7 +752,7 @@ public static partial class OpenIddictServerOwinHandlers
if (!string.IsNullOrEmpty(header) && header.StartsWith("Basic ", StringComparison.OrdinalIgnoreCase) &&
!context.Options.ClientAuthenticationMethods.Contains(ClientAuthenticationMethods.ClientSecretBasic))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6227, ClientAuthenticationMethods.ClientSecretBasic));
context.Logger.LogInformation(6227, SR.GetResourceString(SR.ID6227), ClientAuthenticationMethods.ClientSecretBasic);
context.Reject(
error: Errors.InvalidClient,
@ -810,7 +810,7 @@ public static partial class OpenIddictServerOwinHandlers
if (!string.IsNullOrEmpty(context.Transaction.Request.ClientAssertion) ||
!string.IsNullOrEmpty(context.Transaction.Request.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6140));
context.Logger.LogInformation(6140, SR.GetResourceString(SR.ID6140));
context.Reject(
error: Errors.InvalidRequest,
@ -1347,7 +1347,7 @@ public static partial class OpenIddictServerOwinHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.Logger.LogInformation(6141, SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.HandleRequest();
return default;
@ -1391,7 +1391,7 @@ public static partial class OpenIddictServerOwinHandlers
var response = context.Transaction.GetOwinRequest()?.Context.Response ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0120));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6142), context.Transaction.Response);
context.Logger.LogInformation(6142, SR.GetResourceString(SR.ID6142), context.Transaction.Response);
using var stream = new MemoryStream();
using var writer = new Utf8JsonWriter(stream, new JsonWriterOptions
@ -1500,7 +1500,7 @@ public static partial class OpenIddictServerOwinHandlers
// Don't return the state originally sent by the client application.
context.Transaction.Response.State = null;
context.Logger.LogInformation(SR.GetResourceString(SR.ID6143), context.Transaction.Response);
context.Logger.LogInformation(6143, SR.GetResourceString(SR.ID6143), context.Transaction.Response);
using var stream = new MemoryStream();
using var writer = new StreamWriter(stream);
@ -1559,7 +1559,7 @@ public static partial class OpenIddictServerOwinHandlers
throw new ArgumentNullException(nameof(context));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6145));
context.Logger.LogInformation(6145, SR.GetResourceString(SR.ID6145));
context.HandleRequest();
return default;

10
src/OpenIddict.Server/OpenIddictServerDispatcher.cs

@ -51,14 +51,14 @@ public sealed class OpenIddictServerDispatcher : IOpenIddictServerDispatcher
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && _logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(exception, SR.GetResourceString(SR.ID6132), handler.GetType().FullName, typeof(TContext).FullName);
_logger.LogDebug(6132, exception, SR.GetResourceString(SR.ID6132), handler.GetType().FullName, typeof(TContext).FullName);
throw;
}
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6133), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6133, SR.GetResourceString(SR.ID6133), typeof(TContext).FullName, handler.GetType().FullName);
}
switch (context)
@ -66,21 +66,21 @@ public sealed class OpenIddictServerDispatcher : IOpenIddictServerDispatcher
case BaseRequestContext { IsRequestHandled: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6134), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6134, SR.GetResourceString(SR.ID6134), typeof(TContext).FullName, handler.GetType().FullName);
}
return;
case BaseRequestContext { IsRequestSkipped: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6135), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6135, SR.GetResourceString(SR.ID6135), typeof(TContext).FullName, handler.GetType().FullName);
}
return;
case BaseValidatingContext { IsRejected: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6136), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6136, SR.GetResourceString(SR.ID6136), typeof(TContext).FullName, handler.GetType().FullName);
}
return;

160
src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs

@ -170,7 +170,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0027));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6030), notification.Request);
context.Logger.LogInformation(6030, SR.GetResourceString(SR.ID6030), notification.Request);
}
}
@ -236,7 +236,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0028));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6031));
context.Logger.LogInformation(6031, SR.GetResourceString(SR.ID6031));
}
}
@ -452,7 +452,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests using the unsupported request parameter.
if (!string.IsNullOrEmpty(context.Request.Request))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6032), Parameters.Request);
context.Logger.LogInformation(6032, SR.GetResourceString(SR.ID6032), Parameters.Request);
context.Reject(
error: Errors.RequestNotSupported,
@ -512,7 +512,7 @@ public static partial class OpenIddictServerHandlers
// URN prefix for request tokens it generates, all the other values are automatically rejected.
if (!context.Request.RequestUri.StartsWith(RequestUris.Prefixes.Generic, StringComparison.Ordinal))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6032), Parameters.RequestUri);
context.Logger.LogInformation(6032, SR.GetResourceString(SR.ID6032), Parameters.RequestUri);
context.Reject(
error: Errors.RequestUriNotSupported,
@ -567,7 +567,7 @@ public static partial class OpenIddictServerHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest.
if (string.IsNullOrEmpty(context.ClientId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.ClientId);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.ClientId);
context.Reject(
error: Errors.InvalidRequest,
@ -745,7 +745,7 @@ public static partial class OpenIddictServerHandlers
{
if (context.Request.HasScope(Scopes.OpenId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.RedirectUri);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -763,7 +763,7 @@ public static partial class OpenIddictServerHandlers
// and http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest.
if (!Uri.TryCreate(context.RedirectUri, UriKind.Absolute, out Uri? uri) || OpenIddictHelpers.IsImplicitFileUri(uri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6034), Parameters.RedirectUri, context.RedirectUri);
context.Logger.LogInformation(6034, SR.GetResourceString(SR.ID6034), Parameters.RedirectUri, context.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -778,7 +778,7 @@ public static partial class OpenIddictServerHandlers
// and http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
if (!string.IsNullOrEmpty(uri.Fragment))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6035), Parameters.RedirectUri, context.RedirectUri);
context.Logger.LogInformation(6035, SR.GetResourceString(SR.ID6035), Parameters.RedirectUri, context.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -798,7 +798,7 @@ public static partial class OpenIddictServerHandlers
var parameters = OpenIddictHelpers.ParseQuery(uri.Query);
if (parameters.ContainsKey(Parameters.Iss))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6181), Parameters.RedirectUri, Parameters.Iss);
context.Logger.LogInformation(6181, SR.GetResourceString(SR.ID6181), Parameters.RedirectUri, Parameters.Iss);
context.Reject(
error: Errors.InvalidRequest,
@ -839,7 +839,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests missing the mandatory response_type parameter.
if (string.IsNullOrEmpty(context.Request.ResponseType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.ResponseType);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.ResponseType);
context.Reject(
error: Errors.InvalidRequest,
@ -852,7 +852,7 @@ public static partial class OpenIddictServerHandlers
// Reject code flow requests if the server is not configured to allow the authorization code grant type.
if (context.Request.IsAuthorizationCodeFlow() && !context.Options.GrantTypes.Contains(GrantTypes.AuthorizationCode))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Logger.LogInformation(6036, SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -865,7 +865,7 @@ public static partial class OpenIddictServerHandlers
// Reject implicit flow requests if the server is not configured to allow the implicit grant type.
if (context.Request.IsImplicitFlow() && !context.Options.GrantTypes.Contains(GrantTypes.Implicit))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Logger.LogInformation(6036, SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -879,7 +879,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsHybridFlow() && (!context.Options.GrantTypes.Contains(GrantTypes.AuthorizationCode) ||
!context.Options.GrantTypes.Contains(GrantTypes.Implicit)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Logger.LogInformation(6036, SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -894,7 +894,7 @@ public static partial class OpenIddictServerHandlers
var types = context.Request.GetResponseTypes().ToHashSet(StringComparer.Ordinal);
if (types.Count > 1 && types.Contains(ResponseTypes.None))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6212), context.Request.ResponseType);
context.Logger.LogInformation(6212, SR.GetResourceString(SR.ID6212), context.Request.ResponseType);
context.Reject(
error: Errors.InvalidRequest,
@ -908,7 +908,7 @@ public static partial class OpenIddictServerHandlers
if (!context.Options.ResponseTypes.Any(type => types.SetEquals(
type.Split(Separators.Space, StringSplitOptions.RemoveEmptyEntries))))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Logger.LogInformation(6036, SR.GetResourceString(SR.ID6036), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -951,7 +951,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsQueryResponseMode() && (context.Request.HasResponseType(ResponseTypes.IdToken) ||
context.Request.HasResponseType(ResponseTypes.Token)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6037), context.Request.ResponseType, context.Request.ResponseMode);
context.Logger.LogInformation(6037, SR.GetResourceString(SR.ID6037), context.Request.ResponseType, context.Request.ResponseMode);
context.Reject(
error: Errors.InvalidRequest,
@ -965,7 +965,7 @@ public static partial class OpenIddictServerHandlers
// if the default response_mode inferred from the response_type was explicitly disabled in the options.
if (!ValidateResponseMode(context.Request, context.Options))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6038), context.Request.ResponseMode);
context.Logger.LogInformation(6038, SR.GetResourceString(SR.ID6038), context.Request.ResponseMode);
context.Reject(
error: Errors.InvalidRequest,
@ -1030,7 +1030,7 @@ public static partial class OpenIddictServerHandlers
// Reject authorization requests containing the id_token response_type if no openid scope has been received.
if (context.Request.HasResponseType(ResponseTypes.IdToken) && !context.Request.HasScope(Scopes.OpenId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6039), Scopes.OpenId);
context.Logger.LogInformation(6039, SR.GetResourceString(SR.ID6039), Scopes.OpenId);
context.Reject(
error: Errors.InvalidRequest,
@ -1090,7 +1090,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsImplicitFlow() || context.Request.IsHybridFlow())
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.Nonce);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.Nonce);
context.Reject(
error: Errors.InvalidRequest,
@ -1138,7 +1138,7 @@ public static partial class OpenIddictServerHandlers
{
if (!context.Options.PromptValues.Contains(value))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6233));
context.Logger.LogInformation(6233, SR.GetResourceString(SR.ID6233));
context.Reject(
error: Errors.InvalidRequest,
@ -1155,7 +1155,7 @@ public static partial class OpenIddictServerHandlers
context.Request.HasPromptValue(PromptValues.Login) ||
context.Request.HasPromptValue(PromptValues.SelectAccount)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6040));
context.Logger.LogInformation(6040, SR.GetResourceString(SR.ID6040));
context.Reject(
error: Errors.InvalidRequest,
@ -1198,7 +1198,7 @@ public static partial class OpenIddictServerHandlers
context.Request.HasResponseType(ResponseTypes.Code) &&
string.IsNullOrEmpty(context.Request.CodeChallenge))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.CodeChallenge);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.CodeChallenge);
context.Reject(
error: Errors.InvalidRequest,
@ -1219,7 +1219,7 @@ public static partial class OpenIddictServerHandlers
// Ensure a code_challenge was specified if a code_challenge_method was used.
if (string.IsNullOrEmpty(context.Request.CodeChallenge))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.CodeChallenge);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.CodeChallenge);
context.Reject(
error: Errors.InvalidRequest,
@ -1234,7 +1234,7 @@ public static partial class OpenIddictServerHandlers
if (string.IsNullOrEmpty(context.Request.CodeChallengeMethod) &&
!context.Options.CodeChallengeMethods.Contains(CodeChallengeMethods.Plain))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.CodeChallengeMethod);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.CodeChallengeMethod);
context.Reject(
error: Errors.InvalidRequest,
@ -1248,7 +1248,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.CodeChallengeMethod) &&
!context.Options.CodeChallengeMethods.Contains(context.Request.CodeChallengeMethod))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6041));
context.Logger.LogInformation(6041, SR.GetResourceString(SR.ID6041));
context.Reject(
error: Errors.InvalidRequest,
@ -1261,7 +1261,7 @@ public static partial class OpenIddictServerHandlers
// When code_challenge or code_challenge_method is specified, ensure the response_type includes "code".
if (!context.Request.HasResponseType(ResponseTypes.Code))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6042));
context.Logger.LogInformation(6042, SR.GetResourceString(SR.ID6042));
context.Reject(
error: Errors.InvalidRequest,
@ -1332,7 +1332,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.CodeChallenge) &&
context.Request.HasResponseType(ResponseTypes.Token))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6043));
context.Logger.LogInformation(6043, SR.GetResourceString(SR.ID6043));
context.Reject(
error: Errors.UnauthorizedClient,
@ -1358,7 +1358,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.HasResponseType(ResponseTypes.Token) &&
await _applicationManager.HasClientTypeAsync(application, ClientTypes.Confidential))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6045), context.ClientId);
context.Logger.LogInformation(6045, SR.GetResourceString(SR.ID6045), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1415,7 +1415,7 @@ public static partial class OpenIddictServerHandlers
var uris = await _applicationManager.GetRedirectUrisAsync(application);
if (uris.Length is not 1)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.RedirectUri);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -1433,7 +1433,7 @@ public static partial class OpenIddictServerHandlers
// Otherwise, ensure that the specified redirect_uri is valid and is associated with the client application.
if (!await _applicationManager.ValidateRedirectUriAsync(application, context.RedirectUri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6046), context.RedirectUri);
context.Logger.LogInformation(6046, SR.GetResourceString(SR.ID6046), context.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -1512,7 +1512,7 @@ public static partial class OpenIddictServerHandlers
// If at least one scope was not recognized, return an error.
if (scopes.Count is not 0)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6047), scopes);
context.Logger.LogInformation(6047, SR.GetResourceString(SR.ID6047), scopes);
context.Reject(
error: Errors.InvalidScope,
@ -1565,7 +1565,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the authorization endpoint.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.Authorization))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6048), context.ClientId);
context.Logger.LogInformation(6048, SR.GetResourceString(SR.ID6048), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1619,7 +1619,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsAuthorizationCodeFlow() &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.AuthorizationCode))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6049), context.ClientId);
context.Logger.LogInformation(6049, SR.GetResourceString(SR.ID6049), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1633,7 +1633,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsImplicitFlow() &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.Implicit))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6050), context.ClientId);
context.Logger.LogInformation(6050, SR.GetResourceString(SR.ID6050), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1648,7 +1648,7 @@ public static partial class OpenIddictServerHandlers
(!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.AuthorizationCode) ||
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.Implicit)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6051), context.ClientId);
context.Logger.LogInformation(6051, SR.GetResourceString(SR.ID6051), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1663,7 +1663,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.HasScope(Scopes.OfflineAccess) &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.RefreshToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6052), context.ClientId, Scopes.OfflineAccess);
context.Logger.LogInformation(6052, SR.GetResourceString(SR.ID6052), context.ClientId, Scopes.OfflineAccess);
context.Reject(
error: Errors.InvalidRequest,
@ -1716,7 +1716,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests that specify a response_type for which no permission was granted.
if (!await HasPermissionAsync(context.Request.GetResponseTypes()))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6177), context.ClientId, context.Request.ResponseType);
context.Logger.LogInformation(6177, SR.GetResourceString(SR.ID6177), context.ClientId, context.Request.ResponseType);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1803,7 +1803,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the iterated scope.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Prefixes.Scope + scope))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6052), context.ClientId, scope);
context.Logger.LogInformation(6052, SR.GetResourceString(SR.ID6052), context.ClientId, scope);
context.Reject(
error: Errors.InvalidRequest,
@ -1866,7 +1866,7 @@ public static partial class OpenIddictServerHandlers
{
if (string.IsNullOrEmpty(context.Request.RequestUri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.RequestUri);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.RequestUri);
context.Reject(
error: Errors.InvalidRequest,
@ -1933,7 +1933,7 @@ public static partial class OpenIddictServerHandlers
if (await _applicationManager.HasRequirementAsync(application, Requirements.Features.ProofKeyForCodeExchange))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.CodeChallenge);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.CodeChallenge);
context.Reject(
error: Errors.InvalidRequest,
@ -1981,7 +1981,7 @@ public static partial class OpenIddictServerHandlers
if (!context.IdentityTokenHintPrincipal.HasAudience(context.ClientId) &&
!context.IdentityTokenHintPrincipal.HasPresenter(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6197));
context.Logger.LogWarning(6197, SR.GetResourceString(SR.ID6197));
context.Reject(
error: Errors.InvalidRequest,
@ -2258,7 +2258,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0468));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6237), notification.Request);
context.Logger.LogInformation(6237, SR.GetResourceString(SR.ID6237), notification.Request);
}
}
@ -2325,7 +2325,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0028));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6238));
context.Logger.LogInformation(6238, SR.GetResourceString(SR.ID6238));
}
}
@ -2507,7 +2507,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests using the unsupported request parameter.
if (!string.IsNullOrEmpty(context.Request.Request))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6239), Parameters.Request);
context.Logger.LogInformation(6239, SR.GetResourceString(SR.ID6239), Parameters.Request);
context.Reject(
error: Errors.RequestNotSupported,
@ -2591,7 +2591,7 @@ public static partial class OpenIddictServerHandlers
// See http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest.
if (string.IsNullOrEmpty(context.ClientId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.ClientId);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.ClientId);
context.Reject(
error: Errors.InvalidRequest,
@ -2638,7 +2638,7 @@ public static partial class OpenIddictServerHandlers
{
if (context.Request.HasScope(Scopes.OpenId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.RedirectUri);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -2656,7 +2656,7 @@ public static partial class OpenIddictServerHandlers
// and http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest.
if (!Uri.TryCreate(context.RedirectUri, UriKind.Absolute, out Uri? uri) || OpenIddictHelpers.IsImplicitFileUri(uri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6241), Parameters.RedirectUri, context.RedirectUri);
context.Logger.LogInformation(6241, SR.GetResourceString(SR.ID6241), Parameters.RedirectUri, context.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -2671,7 +2671,7 @@ public static partial class OpenIddictServerHandlers
// and http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
if (!string.IsNullOrEmpty(uri.Fragment))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6242), Parameters.RedirectUri, context.RedirectUri);
context.Logger.LogInformation(6242, SR.GetResourceString(SR.ID6242), Parameters.RedirectUri, context.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -2691,7 +2691,7 @@ public static partial class OpenIddictServerHandlers
var parameters = OpenIddictHelpers.ParseQuery(uri.Query);
if (parameters.ContainsKey(Parameters.Iss))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6259), Parameters.RedirectUri, Parameters.Iss);
context.Logger.LogInformation(6259, SR.GetResourceString(SR.ID6259), Parameters.RedirectUri, Parameters.Iss);
context.Reject(
error: Errors.InvalidRequest,
@ -2733,7 +2733,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests missing the mandatory response_type parameter.
if (string.IsNullOrEmpty(context.Request.ResponseType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.ResponseType);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.ResponseType);
context.Reject(
error: Errors.InvalidRequest,
@ -2746,7 +2746,7 @@ public static partial class OpenIddictServerHandlers
// Reject code flow requests if the server is not configured to allow the authorization code grant type.
if (context.Request.IsAuthorizationCodeFlow() && !context.Options.GrantTypes.Contains(GrantTypes.AuthorizationCode))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Logger.LogInformation(6243, SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -2759,7 +2759,7 @@ public static partial class OpenIddictServerHandlers
// Reject implicit flow requests if the server is not configured to allow the implicit grant type.
if (context.Request.IsImplicitFlow() && !context.Options.GrantTypes.Contains(GrantTypes.Implicit))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Logger.LogInformation(6243, SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -2773,7 +2773,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsHybridFlow() && (!context.Options.GrantTypes.Contains(GrantTypes.AuthorizationCode) ||
!context.Options.GrantTypes.Contains(GrantTypes.Implicit)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Logger.LogInformation(6243, SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -2788,7 +2788,7 @@ public static partial class OpenIddictServerHandlers
var types = context.Request.GetResponseTypes().ToHashSet(StringComparer.Ordinal);
if (types.Count > 1 && types.Contains(ResponseTypes.None))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6260), context.Request.ResponseType);
context.Logger.LogInformation(6260, SR.GetResourceString(SR.ID6260), context.Request.ResponseType);
context.Reject(
error: Errors.InvalidRequest,
@ -2802,7 +2802,7 @@ public static partial class OpenIddictServerHandlers
if (!context.Options.ResponseTypes.Any(type => types.SetEquals(
type.Split(Separators.Space, StringSplitOptions.RemoveEmptyEntries))))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Logger.LogInformation(6243, SR.GetResourceString(SR.ID6243), context.Request.ResponseType);
context.Reject(
error: Errors.UnsupportedResponseType,
@ -2846,7 +2846,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsQueryResponseMode() && (context.Request.HasResponseType(ResponseTypes.IdToken) ||
context.Request.HasResponseType(ResponseTypes.Token)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6244), context.Request.ResponseType, context.Request.ResponseMode);
context.Logger.LogInformation(6244, SR.GetResourceString(SR.ID6244), context.Request.ResponseType, context.Request.ResponseMode);
context.Reject(
error: Errors.InvalidRequest,
@ -2860,7 +2860,7 @@ public static partial class OpenIddictServerHandlers
// if the default response_mode inferred from the response_type was explicitly disabled in the options.
if (!ValidatePushedResponseMode(context.Request, context.Options))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6245), context.Request.ResponseMode);
context.Logger.LogInformation(6245, SR.GetResourceString(SR.ID6245), context.Request.ResponseMode);
context.Reject(
error: Errors.InvalidRequest,
@ -2926,7 +2926,7 @@ public static partial class OpenIddictServerHandlers
// Reject pushed authorization requests containing the id_token response_type if no openid scope has been received.
if (context.Request.HasResponseType(ResponseTypes.IdToken) && !context.Request.HasScope(Scopes.OpenId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6246), Scopes.OpenId);
context.Logger.LogInformation(6246, SR.GetResourceString(SR.ID6246), Scopes.OpenId);
context.Reject(
error: Errors.InvalidRequest,
@ -2986,7 +2986,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsImplicitFlow() || context.Request.IsHybridFlow())
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.Nonce);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.Nonce);
context.Reject(
error: Errors.InvalidRequest,
@ -3034,7 +3034,7 @@ public static partial class OpenIddictServerHandlers
{
if (!context.Options.PromptValues.Contains(value))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6261));
context.Logger.LogInformation(6261, SR.GetResourceString(SR.ID6261));
context.Reject(
error: Errors.InvalidRequest,
@ -3051,7 +3051,7 @@ public static partial class OpenIddictServerHandlers
context.Request.HasPromptValue(PromptValues.Login) ||
context.Request.HasPromptValue(PromptValues.SelectAccount)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6247));
context.Logger.LogInformation(6247, SR.GetResourceString(SR.ID6247));
context.Reject(
error: Errors.InvalidRequest,
@ -3094,7 +3094,7 @@ public static partial class OpenIddictServerHandlers
context.Request.HasResponseType(ResponseTypes.Code) &&
string.IsNullOrEmpty(context.Request.CodeChallenge))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.CodeChallenge);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.CodeChallenge);
context.Reject(
error: Errors.InvalidRequest,
@ -3115,7 +3115,7 @@ public static partial class OpenIddictServerHandlers
// Ensure a code_challenge was specified if a code_challenge_method was used.
if (string.IsNullOrEmpty(context.Request.CodeChallenge))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.CodeChallenge);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.CodeChallenge);
context.Reject(
error: Errors.InvalidRequest,
@ -3130,7 +3130,7 @@ public static partial class OpenIddictServerHandlers
if (string.IsNullOrEmpty(context.Request.CodeChallengeMethod) &&
!context.Options.CodeChallengeMethods.Contains(CodeChallengeMethods.Plain))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.CodeChallengeMethod);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.CodeChallengeMethod);
context.Reject(
error: Errors.InvalidRequest,
@ -3144,7 +3144,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.CodeChallengeMethod) &&
!context.Options.CodeChallengeMethods.Contains(context.Request.CodeChallengeMethod))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6248));
context.Logger.LogInformation(6248, SR.GetResourceString(SR.ID6248));
context.Reject(
error: Errors.InvalidRequest,
@ -3157,7 +3157,7 @@ public static partial class OpenIddictServerHandlers
// When code_challenge or code_challenge_method is specified, ensure the response_type includes "code".
if (!context.Request.HasResponseType(ResponseTypes.Code))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6249));
context.Logger.LogInformation(6249, SR.GetResourceString(SR.ID6249));
context.Reject(
error: Errors.InvalidRequest,
@ -3289,7 +3289,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.CodeChallenge) &&
context.Request.HasResponseType(ResponseTypes.Token))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6250));
context.Logger.LogInformation(6250, SR.GetResourceString(SR.ID6250));
context.Reject(
error: Errors.UnauthorizedClient,
@ -3315,7 +3315,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.HasResponseType(ResponseTypes.Token) &&
await _applicationManager.HasClientTypeAsync(application, ClientTypes.Confidential))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6251), context.ClientId);
context.Logger.LogInformation(6251, SR.GetResourceString(SR.ID6251), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -3372,7 +3372,7 @@ public static partial class OpenIddictServerHandlers
var uris = await _applicationManager.GetRedirectUrisAsync(application);
if (uris.Length is not 1)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.RedirectUri);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -3390,7 +3390,7 @@ public static partial class OpenIddictServerHandlers
// Otherwise, ensure that the specified redirect_uri is valid and is associated with the client application.
if (!await _applicationManager.ValidateRedirectUriAsync(application, context.RedirectUri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6252), context.RedirectUri);
context.Logger.LogInformation(6252, SR.GetResourceString(SR.ID6252), context.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -3469,7 +3469,7 @@ public static partial class OpenIddictServerHandlers
// If at least one scope was not recognized, return an error.
if (scopes.Count is not 0)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6253), scopes);
context.Logger.LogInformation(6253, SR.GetResourceString(SR.ID6253), scopes);
context.Reject(
error: Errors.InvalidScope,
@ -3522,7 +3522,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the pushed authorization endpoint.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.PushedAuthorization))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6254), context.ClientId);
context.Logger.LogInformation(6254, SR.GetResourceString(SR.ID6254), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -3576,7 +3576,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsAuthorizationCodeFlow() &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.AuthorizationCode))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6255), context.ClientId);
context.Logger.LogInformation(6255, SR.GetResourceString(SR.ID6255), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -3590,7 +3590,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsImplicitFlow() &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.Implicit))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6256), context.ClientId);
context.Logger.LogInformation(6256, SR.GetResourceString(SR.ID6256), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -3605,7 +3605,7 @@ public static partial class OpenIddictServerHandlers
(!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.AuthorizationCode) ||
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.Implicit)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6257), context.ClientId);
context.Logger.LogInformation(6257, SR.GetResourceString(SR.ID6257), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -3620,7 +3620,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.HasScope(Scopes.OfflineAccess) &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.RefreshToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6258), context.ClientId, Scopes.OfflineAccess);
context.Logger.LogInformation(6258, SR.GetResourceString(SR.ID6258), context.ClientId, Scopes.OfflineAccess);
context.Reject(
error: Errors.InvalidRequest,
@ -3673,7 +3673,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests that specify a response_type for which no permission was granted.
if (!await HasPermissionAsync(context.Request.GetResponseTypes()))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6262), context.ClientId, context.Request.ResponseType);
context.Logger.LogInformation(6262, SR.GetResourceString(SR.ID6262), context.ClientId, context.Request.ResponseType);
context.Reject(
error: Errors.UnauthorizedClient,
@ -3760,7 +3760,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the iterated scope.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Prefixes.Scope + scope))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6258), context.ClientId, scope);
context.Logger.LogInformation(6258, SR.GetResourceString(SR.ID6258), context.ClientId, scope);
context.Reject(
error: Errors.InvalidRequest,
@ -3820,7 +3820,7 @@ public static partial class OpenIddictServerHandlers
if (await _applicationManager.HasRequirementAsync(application, Requirements.Features.ProofKeyForCodeExchange))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6240), Parameters.CodeChallenge);
context.Logger.LogInformation(6240, SR.GetResourceString(SR.ID6240), Parameters.CodeChallenge);
context.Reject(
error: Errors.InvalidRequest,
@ -3868,7 +3868,7 @@ public static partial class OpenIddictServerHandlers
if (!context.IdentityTokenHintPrincipal.HasAudience(context.ClientId) &&
!context.IdentityTokenHintPrincipal.HasPresenter(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6263));
context.Logger.LogWarning(6263, SR.GetResourceString(SR.ID6263));
context.Reject(
error: Errors.InvalidRequest,

20
src/OpenIddict.Server/OpenIddictServerHandlers.Device.cs

@ -122,7 +122,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0031));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6054), notification.Request);
context.Logger.LogInformation(6054, SR.GetResourceString(SR.ID6054), notification.Request);
}
}
@ -179,7 +179,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6055));
context.Logger.LogInformation(6055, SR.GetResourceString(SR.ID6055));
}
}
@ -423,7 +423,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.ClientAssertion) &&
!string.IsNullOrEmpty(context.Request.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6140));
context.Logger.LogInformation(6140, SR.GetResourceString(SR.ID6140));
context.Reject(
error: Errors.InvalidRequest,
@ -516,7 +516,7 @@ public static partial class OpenIddictServerHandlers
// If at least one scope was not recognized, return an error.
if (scopes.Count is not 0)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6057), scopes);
context.Logger.LogInformation(6057, SR.GetResourceString(SR.ID6057), scopes);
context.Reject(
error: Errors.InvalidScope,
@ -632,7 +632,7 @@ public static partial class OpenIddictServerHandlers
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.DeviceAuthorization) &&
!await _applicationManager.HasPermissionAsync(application, "ept:device"))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6062), context.ClientId);
context.Logger.LogInformation(6062, SR.GetResourceString(SR.ID6062), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -685,7 +685,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the device code grant.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.DeviceCode))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6118), context.ClientId);
context.Logger.LogInformation(6118, SR.GetResourceString(SR.ID6118), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -700,7 +700,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.HasScope(Scopes.OfflineAccess) &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.RefreshToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6120), context.ClientId, Scopes.OfflineAccess);
context.Logger.LogInformation(6120, SR.GetResourceString(SR.ID6120), context.ClientId, Scopes.OfflineAccess);
context.Reject(
error: Errors.InvalidRequest,
@ -764,7 +764,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the iterated scope.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Prefixes.Scope + scope))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6063), context.ClientId, scope);
context.Logger.LogInformation(6063, SR.GetResourceString(SR.ID6063), context.ClientId, scope);
context.Reject(
error: Errors.InvalidRequest,
@ -835,7 +835,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0034));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6064), notification.Request);
context.Logger.LogInformation(6064, SR.GetResourceString(SR.ID6064), notification.Request);
}
}
@ -896,7 +896,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6065));
context.Logger.LogInformation(6065, SR.GetResourceString(SR.ID6065));
}
}

20
src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs

@ -120,7 +120,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0037));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6066), notification.Request);
context.Logger.LogInformation(6066, SR.GetResourceString(SR.ID6066), notification.Request);
}
}
@ -177,7 +177,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6067));
context.Logger.LogInformation(6067, SR.GetResourceString(SR.ID6067));
}
}
@ -911,7 +911,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0038));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6068), notification.Request);
context.Logger.LogInformation(6068, SR.GetResourceString(SR.ID6068), notification.Request);
}
}
@ -968,7 +968,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6069));
context.Logger.LogInformation(6069, SR.GetResourceString(SR.ID6069));
}
}
@ -1036,7 +1036,7 @@ public static partial class OpenIddictServerHandlers
// See https://tools.ietf.org/html/rfc7517#section-4.1
if (string.IsNullOrEmpty(key.Kty))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6070), JsonWebKeyParameterNames.Kty);
context.Logger.LogWarning(6070, SR.GetResourceString(SR.ID6070), JsonWebKeyParameterNames.Kty);
continue;
}
@ -1180,7 +1180,7 @@ public static partial class OpenIddictServerHandlers
!credentials.Key.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha384) &&
!credentials.Key.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha512))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6071), credentials.Key.GetType().Name);
context.Logger.LogInformation(6071, SR.GetResourceString(SR.ID6071), credentials.Key.GetType().Name);
continue;
}
@ -1188,7 +1188,7 @@ public static partial class OpenIddictServerHandlers
if (!credentials.Key.IsSupportedAlgorithm(SecurityAlgorithms.RsaSha256) &&
!credentials.Key.IsSupportedAlgorithm(SecurityAlgorithms.RsaSsaPssSha256))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6072), credentials.Key.GetType().Name);
context.Logger.LogInformation(6072, SR.GetResourceString(SR.ID6072), credentials.Key.GetType().Name);
continue;
}
@ -1250,7 +1250,7 @@ public static partial class OpenIddictServerHandlers
if (parameters is null)
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6073), credentials.Key.GetType().Name);
context.Logger.LogWarning(6073, SR.GetResourceString(SR.ID6073), credentials.Key.GetType().Name);
continue;
}
@ -1282,7 +1282,7 @@ public static partial class OpenIddictServerHandlers
if (parameters is null)
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6074), credentials.Key.GetType().Name);
context.Logger.LogWarning(6074, SR.GetResourceString(SR.ID6074), credentials.Key.GetType().Name);
continue;
}
@ -1294,7 +1294,7 @@ public static partial class OpenIddictServerHandlers
if (string.IsNullOrEmpty(curve))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6167), credentials.Key.GetType().Name);
context.Logger.LogWarning(6167, SR.GetResourceString(SR.ID6167), credentials.Key.GetType().Name);
continue;
}

54
src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs

@ -126,7 +126,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0040));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6075), notification.Request);
context.Logger.LogInformation(6075, SR.GetResourceString(SR.ID6075), notification.Request);
}
}
@ -187,7 +187,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6076));
context.Logger.LogInformation(6076, SR.GetResourceString(SR.ID6076));
}
}
@ -362,7 +362,7 @@ public static partial class OpenIddictServerHandlers
// Reject token requests missing the mandatory grant_type parameter.
if (string.IsNullOrEmpty(context.Request.GrantType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.GrantType);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.GrantType);
context.Reject(
error: Errors.InvalidRequest,
@ -375,7 +375,7 @@ public static partial class OpenIddictServerHandlers
// Reject token requests that don't specify a supported grant type.
if (!context.Options.GrantTypes.Contains(context.Request.GrantType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6078), context.Request.GrantType);
context.Logger.LogInformation(6078, SR.GetResourceString(SR.ID6078), context.Request.GrantType);
context.Reject(
error: Errors.UnsupportedGrantType,
@ -433,7 +433,7 @@ public static partial class OpenIddictServerHandlers
string.IsNullOrEmpty(context.Request.ClientId) &&
string.IsNullOrEmpty(context.Request.ClientAssertion))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.ClientId);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.ClientId);
context.Reject(
error: Errors.InvalidRequest,
@ -450,7 +450,7 @@ public static partial class OpenIddictServerHandlers
string.IsNullOrEmpty(context.Request.ClientId) &&
string.IsNullOrEmpty(context.Request.ClientAssertion))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.ClientId);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.ClientId);
context.Reject(
error: Errors.InvalidRequest,
@ -492,7 +492,7 @@ public static partial class OpenIddictServerHandlers
// See https://tools.ietf.org/html/rfc6749#section-4.1.3 for more information.
if (context.Request.IsAuthorizationCodeGrantType() && string.IsNullOrEmpty(context.Request.Code))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.Code);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.Code);
context.Reject(
error: Errors.InvalidRequest,
@ -559,7 +559,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.ClientAssertion) &&
!string.IsNullOrEmpty(context.Request.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6140));
context.Logger.LogInformation(6140, SR.GetResourceString(SR.ID6140));
context.Reject(
error: Errors.InvalidRequest,
@ -668,7 +668,7 @@ public static partial class OpenIddictServerHandlers
// See https://tools.ietf.org/html/rfc6749#section-6 for more information.
if (context.Request.IsRefreshTokenGrantType() && string.IsNullOrEmpty(context.Request.RefreshToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.RefreshToken);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.RefreshToken);
context.Reject(
error: Errors.InvalidRequest,
@ -711,7 +711,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.IsPasswordGrantType() && (string.IsNullOrEmpty(context.Request.Username) ||
string.IsNullOrEmpty(context.Request.Password)))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6079));
context.Logger.LogInformation(6079, SR.GetResourceString(SR.ID6079));
context.Reject(
error: Errors.InvalidRequest,
@ -759,7 +759,7 @@ public static partial class OpenIddictServerHandlers
// If OpenIddict was configured to require PKCE, this can be potentially avoided by making an early check here.
if (context.Options.RequireProofKeyForCodeExchange && string.IsNullOrEmpty(context.Request.CodeVerifier))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.CodeVerifier);
context.Logger.LogInformation(6033, SR.GetResourceString(SR.ID6033), Parameters.CodeVerifier);
context.Reject(
error: Errors.InvalidRequest,
@ -806,7 +806,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.Scope) && (context.Request.IsAuthorizationCodeGrantType() ||
context.Request.IsDeviceCodeGrantType()))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6094), Parameters.Scope);
context.Logger.LogInformation(6094, SR.GetResourceString(SR.ID6094), Parameters.Scope);
context.Reject(
error: Errors.InvalidRequest,
@ -887,7 +887,7 @@ public static partial class OpenIddictServerHandlers
// If at least one scope was not recognized, return an error.
if (scopes.Count is not 0)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6080), scopes);
context.Logger.LogInformation(6080, SR.GetResourceString(SR.ID6080), scopes);
context.Reject(
error: Errors.InvalidScope,
@ -1005,7 +1005,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the token endpoint.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.Token))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6086), context.ClientId);
context.Logger.LogInformation(6086, SR.GetResourceString(SR.ID6086), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1060,7 +1060,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the specified grant type.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Prefixes.GrantType + context.Request.GrantType))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6087), context.ClientId, context.Request.GrantType);
context.Logger.LogInformation(6087, SR.GetResourceString(SR.ID6087), context.ClientId, context.Request.GrantType);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1075,7 +1075,7 @@ public static partial class OpenIddictServerHandlers
if (context.Request.HasScope(Scopes.OfflineAccess) &&
!await _applicationManager.HasPermissionAsync(application, Permissions.GrantTypes.RefreshToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6088), context.ClientId, Scopes.OfflineAccess);
context.Logger.LogInformation(6088, SR.GetResourceString(SR.ID6088), context.ClientId, Scopes.OfflineAccess);
context.Reject(
error: Errors.InvalidRequest,
@ -1139,7 +1139,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the iterated scope.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Prefixes.Scope + scope))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6089), context.ClientId, scope);
context.Logger.LogInformation(6089, SR.GetResourceString(SR.ID6089), context.ClientId, scope);
context.Reject(
error: Errors.InvalidRequest,
@ -1205,7 +1205,7 @@ public static partial class OpenIddictServerHandlers
if (await _applicationManager.HasRequirementAsync(application, Requirements.Features.ProofKeyForCodeExchange))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.CodeVerifier);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.CodeVerifier);
context.Reject(
error: Errors.InvalidRequest,
@ -1272,7 +1272,7 @@ public static partial class OpenIddictServerHandlers
// reject the request if the client_id of the caller cannot be retrieved or inferred.
if (string.IsNullOrEmpty(context.ClientId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6090));
context.Logger.LogInformation(6090, SR.GetResourceString(SR.ID6090));
context.Reject(
error: Errors.InvalidGrant,
@ -1292,7 +1292,7 @@ public static partial class OpenIddictServerHandlers
// and http://openid.net/specs/openid-connect-core-1_0.html#RefreshingAccessToken.
if (!presenters.Contains(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6091));
context.Logger.LogWarning(6091, SR.GetResourceString(SR.ID6091));
context.Reject(
error: Errors.InvalidGrant,
@ -1355,7 +1355,7 @@ public static partial class OpenIddictServerHandlers
if (string.IsNullOrEmpty(context.Request.RedirectUri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.RedirectUri);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.RedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -1367,7 +1367,7 @@ public static partial class OpenIddictServerHandlers
if (!string.Equals(uri, context.Request.RedirectUri, StringComparison.Ordinal))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6092), Parameters.RedirectUri);
context.Logger.LogInformation(6092, SR.GetResourceString(SR.ID6092), Parameters.RedirectUri);
context.Reject(
error: Errors.InvalidGrant,
@ -1424,7 +1424,7 @@ public static partial class OpenIddictServerHandlers
// when no code_challenge private claim was attached to the authorization code.
if (!string.IsNullOrEmpty(context.Request.CodeVerifier))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6093), Parameters.CodeVerifier);
context.Logger.LogInformation(6093, SR.GetResourceString(SR.ID6093), Parameters.CodeVerifier);
context.Reject(
error: Errors.InvalidRequest,
@ -1440,7 +1440,7 @@ public static partial class OpenIddictServerHandlers
// Get the code verifier from the token request. If it cannot be found, return an invalid_grant error.
if (string.IsNullOrEmpty(context.Request.CodeVerifier))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6077), Parameters.CodeVerifier);
context.Logger.LogInformation(6077, SR.GetResourceString(SR.ID6077), Parameters.CodeVerifier);
context.Reject(
error: Errors.InvalidRequest,
@ -1470,7 +1470,7 @@ public static partial class OpenIddictServerHandlers
left: MemoryMarshal.AsBytes(comparand.AsSpan()),
right: MemoryMarshal.AsBytes(challenge.AsSpan())))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6092), Parameters.CodeVerifier);
context.Logger.LogInformation(6092, SR.GetResourceString(SR.ID6092), Parameters.CodeVerifier);
context.Reject(
error: Errors.InvalidGrant,
@ -1521,7 +1521,7 @@ public static partial class OpenIddictServerHandlers
var scopes = context.Principal.GetScopes().ToHashSet(StringComparer.Ordinal);
if (scopes.Count is 0)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6094), Parameters.Scope);
context.Logger.LogInformation(6094, SR.GetResourceString(SR.ID6094), Parameters.Scope);
context.Reject(
error: Errors.InvalidGrant,
@ -1537,7 +1537,7 @@ public static partial class OpenIddictServerHandlers
// See https://tools.ietf.org/html/rfc6749#section-6 for more information.
else if (!scopes.IsSupersetOf(context.Request.GetScopes()))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6095), Parameters.Scope);
context.Logger.LogInformation(6095, SR.GetResourceString(SR.ID6095), Parameters.Scope);
context.Reject(
error: Errors.InvalidGrant,

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

@ -113,7 +113,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0046));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6096), notification.Request);
context.Logger.LogInformation(6096, SR.GetResourceString(SR.ID6096), notification.Request);
}
}
@ -174,7 +174,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6097));
context.Logger.LogInformation(6097, SR.GetResourceString(SR.ID6097));
}
}
@ -355,7 +355,7 @@ public static partial class OpenIddictServerHandlers
// Reject introspection requests missing the mandatory token parameter.
if (string.IsNullOrEmpty(context.Request.Token))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6098), Parameters.Token);
context.Logger.LogInformation(6098, SR.GetResourceString(SR.ID6098), Parameters.Token);
context.Reject(
error: Errors.InvalidRequest,
@ -422,7 +422,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.ClientAssertion) &&
!string.IsNullOrEmpty(context.Request.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6140));
context.Logger.LogInformation(6140, SR.GetResourceString(SR.ID6140));
context.Reject(
error: Errors.InvalidRequest,
@ -552,7 +552,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the introspection endpoint.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.Introspection))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6103), context.ClientId);
context.Logger.LogInformation(6103, SR.GetResourceString(SR.ID6103), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -592,7 +592,7 @@ public static partial class OpenIddictServerHandlers
if (!context.Principal.HasTokenType(TokenTypeIdentifiers.AccessToken) &&
!context.Principal.HasTokenType(TokenTypeIdentifiers.RefreshToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6104));
context.Logger.LogInformation(6104, SR.GetResourceString(SR.ID6104));
context.Reject(
error: Errors.UnsupportedTokenType,
@ -645,7 +645,7 @@ public static partial class OpenIddictServerHandlers
context.Principal.HasClaim(Claims.Private.Audience) && !context.Principal.HasAudience(context.ClientId) &&
context.Principal.HasClaim(Claims.Private.Presenter) && !context.Principal.HasPresenter(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6106));
context.Logger.LogWarning(6106, SR.GetResourceString(SR.ID6106));
context.Reject(
error: Errors.InvalidToken,
@ -662,7 +662,7 @@ public static partial class OpenIddictServerHandlers
if (context.Principal.HasTokenType(TokenTypeIdentifiers.RefreshToken) &&
context.Principal.HasClaim(Claims.Private.Presenter) && !context.Principal.HasPresenter(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6108));
context.Logger.LogWarning(6108, SR.GetResourceString(SR.ID6108));
context.Reject(
error: Errors.InvalidToken,
@ -820,7 +820,7 @@ public static partial class OpenIddictServerHandlers
// the sensitive application-specific claims contained in the introspected access token.
if (!context.Principal.HasAudience(context.Request.ClientId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6105), context.Request.ClientId);
context.Logger.LogInformation(6105, SR.GetResourceString(SR.ID6105), context.Request.ClientId);
return;
}
@ -831,7 +831,7 @@ public static partial class OpenIddictServerHandlers
// Public clients are not allowed to access sensitive claims as authentication cannot be enforced.
if (await _applicationManager.HasClientTypeAsync(application, ClientTypes.Public))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6107), context.Request.ClientId);
context.Logger.LogInformation(6107, SR.GetResourceString(SR.ID6107), context.Request.ClientId);
return;
}

26
src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs

@ -452,7 +452,7 @@ public static partial class OpenIddictServerHandlers
var result = await context.SecurityTokenHandler.ValidateTokenAsync(context.Token, context.TokenValidationParameters);
if (!result.IsValid)
{
context.Logger.LogTrace(result.Exception, SR.GetResourceString(SR.ID6000), context.Token);
context.Logger.LogTrace(6000, result.Exception, SR.GetResourceString(SR.ID6000), context.Token);
context.Reject(
error: context.ValidTokenTypes.Count switch
@ -570,7 +570,7 @@ public static partial class OpenIddictServerHandlers
context.Principal.SetDestinations(builder.ToImmutable());
}
context.Logger.LogTrace(SR.GetResourceString(SR.ID6001), context.Token, context.Principal.Claims);
context.Logger.LogTrace(6001, SR.GetResourceString(SR.ID6001), context.Token, context.Principal.Claims);
}
}
@ -1016,16 +1016,16 @@ public static partial class OpenIddictServerHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogWarning(exception, SR.GetResourceString(SR.ID6229), context.AuthorizationId);
context.Logger.LogWarning(6229, exception, SR.GetResourceString(SR.ID6229), context.AuthorizationId);
}
if (count is not null)
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6228), count, context.AuthorizationId);
context.Logger.LogWarning(6228, SR.GetResourceString(SR.ID6228), count, context.AuthorizationId);
}
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6002), context.TokenId);
context.Logger.LogInformation(6002, SR.GetResourceString(SR.ID6002), context.TokenId);
context.Reject(
error: context.Principal.GetTokenType() switch
@ -1060,7 +1060,7 @@ public static partial class OpenIddictServerHandlers
// If the token is not marked as valid yet, return an authorization_pending error.
if (await _tokenManager.HasStatusAsync(token, Statuses.Inactive))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6003), context.TokenId);
context.Logger.LogInformation(6003, SR.GetResourceString(SR.ID6003), context.TokenId);
context.Reject(
error: Errors.AuthorizationPending,
@ -1073,7 +1073,7 @@ public static partial class OpenIddictServerHandlers
// If the token is marked as rejected, return an access_denied error.
if (await _tokenManager.HasStatusAsync(token, Statuses.Rejected))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6004), context.TokenId);
context.Logger.LogInformation(6004, SR.GetResourceString(SR.ID6004), context.TokenId);
context.Reject(
error: Errors.AccessDenied,
@ -1085,7 +1085,7 @@ public static partial class OpenIddictServerHandlers
if (!await _tokenManager.HasStatusAsync(token, Statuses.Valid))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6005), context.TokenId);
context.Logger.LogInformation(6005, SR.GetResourceString(SR.ID6005), context.TokenId);
context.Reject(
error: context.Principal.GetTokenType() switch
@ -1175,7 +1175,7 @@ public static partial class OpenIddictServerHandlers
var authorization = await _authorizationManager.FindByIdAsync(context.AuthorizationId);
if (authorization is null || !await _authorizationManager.HasStatusAsync(authorization, Statuses.Valid))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6006), context.AuthorizationId);
context.Logger.LogInformation(6006, SR.GetResourceString(SR.ID6006), context.AuthorizationId);
context.Reject(
error: context.Principal.GetTokenType() switch
@ -1341,7 +1341,7 @@ public static partial class OpenIddictServerHandlers
// Attach the token identifier to the principal so that it can be stored in the token payload.
context.Principal.SetTokenId(identifier);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6012), context.TokenType, identifier);
context.Logger.LogTrace(6012, SR.GetResourceString(SR.ID6012), context.TokenType, identifier);
}
}
@ -1545,7 +1545,7 @@ public static partial class OpenIddictServerHandlers
context.Token = context.SecurityTokenHandler.CreateToken(context.SecurityTokenDescriptor);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6013), context.TokenType,
context.Logger.LogTrace(6013, SR.GetResourceString(SR.ID6013), context.TokenType,
context.Token, context.SecurityTokenDescriptor.Subject?.Claims ?? []);
return default;
@ -1628,13 +1628,13 @@ public static partial class OpenIddictServerHandlers
await _tokenManager.UpdateAsync(token, descriptor);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6014), context.Token, identifier, context.TokenType);
context.Logger.LogTrace(6014, SR.GetResourceString(SR.ID6014), context.Token, identifier, context.TokenType);
// Replace the returned token by the reference identifier, if applicable.
if (context.IsReferenceToken)
{
context.Token = descriptor.ReferenceId;
context.Logger.LogTrace(SR.GetResourceString(SR.ID6015), descriptor.ReferenceId, identifier, context.TokenType);
context.Logger.LogTrace(6015, SR.GetResourceString(SR.ID6015), descriptor.ReferenceId, identifier, context.TokenType);
}
}
}

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

@ -106,7 +106,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0048));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6109), notification.Request);
context.Logger.LogInformation(6109, SR.GetResourceString(SR.ID6109), notification.Request);
}
}
@ -167,7 +167,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6110));
context.Logger.LogInformation(6110, SR.GetResourceString(SR.ID6110));
}
}
@ -302,7 +302,7 @@ public static partial class OpenIddictServerHandlers
// Reject revocation requests missing the mandatory token parameter.
if (string.IsNullOrEmpty(context.Request.Token))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6111), Parameters.Token);
context.Logger.LogInformation(6111, SR.GetResourceString(SR.ID6111), Parameters.Token);
context.Reject(
error: Errors.InvalidRequest,
@ -369,7 +369,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(context.Request.ClientAssertion) &&
!string.IsNullOrEmpty(context.Request.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6140));
context.Logger.LogInformation(6140, SR.GetResourceString(SR.ID6140));
context.Reject(
error: Errors.InvalidRequest,
@ -499,7 +499,7 @@ public static partial class OpenIddictServerHandlers
// Reject the request if the application is not allowed to use the revocation endpoint.
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.Revocation))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6116), context.ClientId);
context.Logger.LogInformation(6116, SR.GetResourceString(SR.ID6116), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -539,7 +539,7 @@ public static partial class OpenIddictServerHandlers
if (!context.Principal.HasTokenType(TokenTypeIdentifiers.AccessToken) &&
!context.Principal.HasTokenType(TokenTypeIdentifiers.RefreshToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6117));
context.Logger.LogInformation(6117, SR.GetResourceString(SR.ID6117));
context.Reject(
error: Errors.UnsupportedTokenType,
@ -592,7 +592,7 @@ public static partial class OpenIddictServerHandlers
context.Principal.HasClaim(Claims.Private.Audience) && !context.Principal.HasAudience(context.ClientId) &&
context.Principal.HasClaim(Claims.Private.Presenter) && !context.Principal.HasPresenter(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6119));
context.Logger.LogWarning(6119, SR.GetResourceString(SR.ID6119));
context.Reject(
error: Errors.InvalidToken,
@ -609,7 +609,7 @@ public static partial class OpenIddictServerHandlers
if (context.Principal.HasTokenType(TokenTypeIdentifiers.RefreshToken) &&
context.Principal.HasClaim(Claims.Private.Presenter) && !context.Principal.HasPresenter(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6121));
context.Logger.LogWarning(6121, SR.GetResourceString(SR.ID6121));
context.Reject(
error: Errors.InvalidToken,
@ -697,7 +697,7 @@ public static partial class OpenIddictServerHandlers
var identifier = context.Principal.GetTokenId();
if (string.IsNullOrEmpty(identifier))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6122));
context.Logger.LogInformation(6122, SR.GetResourceString(SR.ID6122));
context.Reject(
error: Errors.UnsupportedTokenType,
@ -710,7 +710,7 @@ public static partial class OpenIddictServerHandlers
var token = await _tokenManager.FindByIdAsync(identifier);
if (token is null)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6123), identifier);
context.Logger.LogInformation(6123, SR.GetResourceString(SR.ID6123), identifier);
context.Reject(
error: Errors.InvalidToken,

18
src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs

@ -114,7 +114,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0050));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6124), notification.Request);
context.Logger.LogInformation(6124, SR.GetResourceString(SR.ID6124), notification.Request);
}
}
@ -175,7 +175,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6125));
context.Logger.LogInformation(6125, SR.GetResourceString(SR.ID6125));
}
}
@ -443,7 +443,7 @@ public static partial class OpenIddictServerHandlers
// If an optional post_logout_redirect_uri was provided, validate it.
if (!Uri.TryCreate(context.PostLogoutRedirectUri, UriKind.Absolute, out Uri? uri) || OpenIddictHelpers.IsImplicitFileUri(uri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6126), Parameters.PostLogoutRedirectUri, context.PostLogoutRedirectUri);
context.Logger.LogInformation(6126, SR.GetResourceString(SR.ID6126), Parameters.PostLogoutRedirectUri, context.PostLogoutRedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -455,7 +455,7 @@ public static partial class OpenIddictServerHandlers
if (!string.IsNullOrEmpty(uri.Fragment))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6127), Parameters.PostLogoutRedirectUri, context.PostLogoutRedirectUri);
context.Logger.LogInformation(6127, SR.GetResourceString(SR.ID6127), Parameters.PostLogoutRedirectUri, context.PostLogoutRedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -632,7 +632,7 @@ public static partial class OpenIddictServerHandlers
if (!await _applicationManager.ValidatePostLogoutRedirectUriAsync(application, context.PostLogoutRedirectUri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6128), context.PostLogoutRedirectUri);
context.Logger.LogInformation(6128, SR.GetResourceString(SR.ID6128), context.PostLogoutRedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -647,7 +647,7 @@ public static partial class OpenIddictServerHandlers
if (!await ValidatePostLogoutRedirectUriAsync(context.PostLogoutRedirectUri))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6128), context.PostLogoutRedirectUri);
context.Logger.LogInformation(6128, SR.GetResourceString(SR.ID6128), context.PostLogoutRedirectUri);
context.Reject(
error: Errors.InvalidRequest,
@ -769,7 +769,7 @@ public static partial class OpenIddictServerHandlers
if (!await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.EndSession) &&
!await _applicationManager.HasPermissionAsync(application, "ept:logout"))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6048), context.ClientId);
context.Logger.LogInformation(6048, SR.GetResourceString(SR.ID6048), context.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -845,7 +845,7 @@ public static partial class OpenIddictServerHandlers
if (!context.IdentityTokenHintPrincipal.HasAudience(context.ClientId) &&
!context.IdentityTokenHintPrincipal.HasPresenter(context.ClientId))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6198));
context.Logger.LogWarning(6198, SR.GetResourceString(SR.ID6198));
context.Reject(
error: Errors.InvalidRequest,
@ -867,7 +867,7 @@ public static partial class OpenIddictServerHandlers
if (!await ValidateAuthorizedParty(context.IdentityTokenHintPrincipal, context.PostLogoutRedirectUri))
{
context.Logger.LogWarning(SR.GetResourceString(SR.ID6198));
context.Logger.LogWarning(6198, SR.GetResourceString(SR.ID6198));
context.Reject(
error: Errors.InvalidRequest,

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

@ -99,7 +99,7 @@ public static partial class OpenIddictServerHandlers
throw new InvalidOperationException(SR.GetResourceString(SR.ID0053));
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6129), notification.Request);
context.Logger.LogInformation(6129, SR.GetResourceString(SR.ID6129), notification.Request);
}
}
@ -160,7 +160,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6130));
context.Logger.LogInformation(6130, SR.GetResourceString(SR.ID6130));
}
}
@ -329,7 +329,7 @@ public static partial class OpenIddictServerHandlers
if (string.IsNullOrEmpty(context.Request.AccessToken))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6131), Parameters.AccessToken);
context.Logger.LogInformation(6131, SR.GetResourceString(SR.ID6131), Parameters.AccessToken);
context.Reject(
error: Errors.MissingToken,

28
src/OpenIddict.Server/OpenIddictServerHandlers.cs

@ -174,7 +174,7 @@ public static partial class OpenIddictServerHandlers
if (context.EndpointType is not OpenIddictServerEndpointType.Unknown)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6053), context.EndpointType);
context.Logger.LogInformation(6053, SR.GetResourceString(SR.ID6053), context.EndpointType);
}
return default;
@ -1061,7 +1061,7 @@ public static partial class OpenIddictServerHandlers
return;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6220), Parameters.ClientId);
context.Logger.LogInformation(6220, SR.GetResourceString(SR.ID6220), Parameters.ClientId);
context.Reject(
error: Errors.InvalidClient,
@ -1083,7 +1083,7 @@ public static partial class OpenIddictServerHandlers
var application = await _applicationManager.FindByClientIdAsync(context.ClientId);
if (application is null)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6221), context.ClientId);
context.Logger.LogInformation(6221, SR.GetResourceString(SR.ID6221), context.ClientId);
context.Reject(
error: context.EndpointType switch
@ -1159,7 +1159,7 @@ public static partial class OpenIddictServerHandlers
if (context.EndpointType is OpenIddictServerEndpointType.Token &&
context.Request.IsClientCredentialsGrantType())
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6222), context.Request.ClientId);
context.Logger.LogInformation(6222, SR.GetResourceString(SR.ID6222), context.Request.ClientId);
context.Reject(
error: Errors.UnauthorizedClient,
@ -1172,7 +1172,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests containing a client_assertion when the client is a public application.
if (!string.IsNullOrEmpty(context.ClientAssertion))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6226), context.ClientId);
context.Logger.LogInformation(6226, SR.GetResourceString(SR.ID6226), context.ClientId);
context.Reject(
error: Errors.InvalidClient,
@ -1185,7 +1185,7 @@ public static partial class OpenIddictServerHandlers
// Reject requests containing a client_secret when the client is a public application.
if (!string.IsNullOrEmpty(context.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6223), context.ClientId);
context.Logger.LogInformation(6223, SR.GetResourceString(SR.ID6223), context.ClientId);
context.Reject(
error: Errors.InvalidClient,
@ -1201,7 +1201,7 @@ public static partial class OpenIddictServerHandlers
// Confidential and hybrid applications MUST authenticate to protect them from impersonation attacks.
if (context.ClientAssertionPrincipal is null && string.IsNullOrEmpty(context.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6224), context.ClientId);
context.Logger.LogInformation(6224, SR.GetResourceString(SR.ID6224), context.ClientId);
context.Reject(
error: Errors.InvalidClient,
@ -1271,7 +1271,7 @@ public static partial class OpenIddictServerHandlers
if (!await _applicationManager.ValidateClientSecretAsync(application, context.ClientSecret))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6225), context.ClientId);
context.Logger.LogInformation(6225, SR.GetResourceString(SR.ID6225), context.ClientId);
context.Reject(
error: Errors.InvalidClient,
@ -3034,12 +3034,12 @@ public static partial class OpenIddictServerHandlers
if (string.IsNullOrEmpty(context.Request.ClientId))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6007), identifier);
context.Logger.LogInformation(6007, SR.GetResourceString(SR.ID6007), identifier);
}
else
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6008), context.Request.ClientId, identifier);
context.Logger.LogInformation(6008, SR.GetResourceString(SR.ID6008), context.Request.ClientId, identifier);
}
// Attach the unique identifier of the ad hoc authorization to the authentication principal
@ -3135,7 +3135,7 @@ public static partial class OpenIddictServerHandlers
// contain "access_token" are not included in the access token.
if (!claim.HasDestination(Destinations.AccessToken))
{
context.Logger.LogDebug(SR.GetResourceString(SR.ID6009), claim.Type);
context.Logger.LogDebug(6009, SR.GetResourceString(SR.ID6009), claim.Type);
return false;
}
@ -3199,7 +3199,7 @@ public static partial class OpenIddictServerHandlers
var scopes = context.Request.GetScopes();
principal.SetScopes(scopes.Intersect(context.Principal.GetScopes()));
context.Logger.LogDebug(SR.GetResourceString(SR.ID6010), scopes);
context.Logger.LogDebug(6010, SR.GetResourceString(SR.ID6010), scopes);
}
context.AccessTokenPrincipal = principal;
@ -3780,7 +3780,7 @@ public static partial class OpenIddictServerHandlers
// contain "id_token" are not included in the identity token.
if (!claim.HasDestination(Destinations.IdentityToken))
{
context.Logger.LogDebug(SR.GetResourceString(SR.ID6011), claim.Type);
context.Logger.LogDebug(6011, SR.GetResourceString(SR.ID6011), claim.Type);
return false;
}
@ -4427,7 +4427,7 @@ public static partial class OpenIddictServerHandlers
await _tokenManager.UpdateAsync(token, descriptor);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6021), await _tokenManager.GetIdAsync(token));
context.Logger.LogTrace(6021, SR.GetResourceString(SR.ID6021), await _tokenManager.GetIdAsync(token));
}
}

2
src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs

@ -646,7 +646,7 @@ public static partial class OpenIddictValidationAspNetCoreHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.Logger.LogInformation(6141, SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.HandleRequest();
return default;

4
src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs

@ -106,7 +106,7 @@ public static partial class OpenIddictValidationDataProtectionHandlers
context.Principal = principal;
context.Logger.LogTrace(SR.GetResourceString(SR.ID6152), context.Token, context.Principal.Claims);
context.Logger.LogTrace(6152, SR.GetResourceString(SR.ID6152), context.Token, context.Principal.Claims);
return default;
@ -138,7 +138,7 @@ public static partial class OpenIddictValidationDataProtectionHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogTrace(exception, SR.GetResourceString(SR.ID6153), context.Token);
context.Logger.LogTrace(6153, exception, SR.GetResourceString(SR.ID6153), context.Token);
return null;
}

2
src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs

@ -789,7 +789,7 @@ public static partial class OpenIddictValidationOwinHandlers
return default;
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.Logger.LogInformation(6141, SR.GetResourceString(SR.ID6141), context.Transaction.Response);
context.HandleRequest();
return default;

8
src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs

@ -635,7 +635,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers
// In this case, log the error details and return a generic error to stop processing the event.
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6182));
context.Logger.LogError(6182, exception, SR.GetResourceString(SR.ID6182));
context.Reject(
error: Errors.ServerError,
@ -892,7 +892,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers
// a server error occurs while the JSON response is being generated and returned to the client.
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6183),
context.Logger.LogError(6183, exception, SR.GetResourceString(SR.ID6183),
await response.Content.ReadAsStringAsync());
context.Reject(
@ -1030,7 +1030,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers
// error could be extracted from the payload or from the WWW-Authenticate header.
if (!response.IsSuccessStatusCode && string.IsNullOrEmpty(context.Transaction.Response?.Error))
{
context.Logger.LogError(SR.GetResourceString(SR.ID6184), response.StatusCode,
context.Logger.LogError(6184, SR.GetResourceString(SR.ID6184), response.StatusCode,
await response.Content.ReadAsStringAsync());
context.Reject(
@ -1054,7 +1054,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers
// (e.g because an unsupported content type was returned), return a generic error.
if (context.Transaction.Response is null)
{
context.Logger.LogError(SR.GetResourceString(SR.ID6185), response.StatusCode,
context.Logger.LogError(6185, SR.GetResourceString(SR.ID6185), response.StatusCode,
response.Content.Headers.ContentType, await response.Content.ReadAsStringAsync());
context.Reject(

10
src/OpenIddict.Validation/OpenIddictValidationDispatcher.cs

@ -51,14 +51,14 @@ public sealed class OpenIddictValidationDispatcher : IOpenIddictValidationDispat
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && _logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(exception, SR.GetResourceString(SR.ID6132), handler.GetType().FullName, typeof(TContext).FullName);
_logger.LogDebug(6132, exception, SR.GetResourceString(SR.ID6132), handler.GetType().FullName, typeof(TContext).FullName);
throw;
}
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6133), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6133, SR.GetResourceString(SR.ID6133), typeof(TContext).FullName, handler.GetType().FullName);
}
switch (context)
@ -66,21 +66,21 @@ public sealed class OpenIddictValidationDispatcher : IOpenIddictValidationDispat
case BaseRequestContext { IsRequestHandled: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6134), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6134, SR.GetResourceString(SR.ID6134), typeof(TContext).FullName, handler.GetType().FullName);
}
return;
case BaseRequestContext { IsRequestSkipped: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6135), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6135, SR.GetResourceString(SR.ID6135), typeof(TContext).FullName, handler.GetType().FullName);
}
return;
case BaseValidatingContext { IsRejected: true }:
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(SR.GetResourceString(SR.ID6136), typeof(TContext).FullName, handler.GetType().FullName);
_logger.LogDebug(6136, SR.GetResourceString(SR.ID6136), typeof(TContext).FullName, handler.GetType().FullName);
}
return;

4
src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs

@ -140,7 +140,7 @@ public static partial class OpenIddictValidationHandlers
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6203), context.Response);
context.Logger.LogInformation(6203, SR.GetResourceString(SR.ID6203), context.Response);
context.Reject(
error: Errors.ServerError,
@ -477,7 +477,7 @@ public static partial class OpenIddictValidationHandlers
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6204), context.Response);
context.Logger.LogInformation(6204, SR.GetResourceString(SR.ID6204), context.Response);
context.Reject(
error: Errors.ServerError,

2
src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs

@ -138,7 +138,7 @@ public static partial class OpenIddictValidationHandlers
// For more information, see https://datatracker.ietf.org/doc/html/rfc7662#section-2.3.
if (!string.IsNullOrEmpty(context.Response.Error))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6205), context.Response);
context.Logger.LogInformation(6205, SR.GetResourceString(SR.ID6205), context.Response);
context.Reject(
error: context.Response.Error switch

16
src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs

@ -311,7 +311,7 @@ public static partial class OpenIddictValidationHandlers
context.Options.ConfigurationManager.RequestRefresh();
}
context.Logger.LogTrace(result.Exception, SR.GetResourceString(SR.ID6000), context.Token);
context.Logger.LogTrace(6000, result.Exception, SR.GetResourceString(SR.ID6000), context.Token);
context.Reject(
error: Errors.InvalidToken,
@ -373,7 +373,7 @@ public static partial class OpenIddictValidationHandlers
string value => value
});
context.Logger.LogTrace(SR.GetResourceString(SR.ID6001), context.Token, context.Principal.Claims);
context.Logger.LogTrace(6001, SR.GetResourceString(SR.ID6001), context.Token, context.Principal.Claims);
}
}
@ -674,7 +674,7 @@ public static partial class OpenIddictValidationHandlers
if (context.Principal.GetExpirationDate() is DateTimeOffset date &&
date + context.TokenValidationParameters.ClockSkew < context.Options.TimeProvider.GetUtcNow())
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6156));
context.Logger.LogInformation(6156, SR.GetResourceString(SR.ID6156));
context.Reject(
error: Errors.InvalidToken,
@ -725,7 +725,7 @@ public static partial class OpenIddictValidationHandlers
var audiences = context.Principal.GetAudiences();
if (audiences.IsDefaultOrEmpty)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6157));
context.Logger.LogInformation(6157, SR.GetResourceString(SR.ID6157));
context.Reject(
error: Errors.InvalidToken,
@ -738,7 +738,7 @@ public static partial class OpenIddictValidationHandlers
// If the access token doesn't include any registered audience, return an error.
if (!audiences.Intersect(context.Options.Audiences, StringComparer.Ordinal).Any())
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6158));
context.Logger.LogInformation(6158, SR.GetResourceString(SR.ID6158));
context.Reject(
error: Errors.InvalidToken,
@ -794,7 +794,7 @@ public static partial class OpenIddictValidationHandlers
if (!await _tokenManager.HasStatusAsync(token, Statuses.Valid))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6005), context.TokenId);
context.Logger.LogInformation(6005, SR.GetResourceString(SR.ID6005), context.TokenId);
context.Reject(
error: Errors.InvalidToken,
@ -846,7 +846,7 @@ public static partial class OpenIddictValidationHandlers
var authorization = await _authorizationManager.FindByIdAsync(context.AuthorizationId);
if (authorization is null || !await _authorizationManager.HasStatusAsync(authorization, Statuses.Valid))
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6006), context.AuthorizationId);
context.Logger.LogInformation(6006, SR.GetResourceString(SR.ID6006), context.AuthorizationId);
context.Reject(
error: Errors.InvalidToken,
@ -1027,7 +1027,7 @@ public static partial class OpenIddictValidationHandlers
context.Token = context.SecurityTokenHandler.CreateToken(context.SecurityTokenDescriptor);
context.Logger.LogTrace(SR.GetResourceString(SR.ID6013), context.TokenType,
context.Logger.LogTrace(6013, SR.GetResourceString(SR.ID6013), context.TokenType,
context.Token, context.SecurityTokenDescriptor.Subject?.Claims ?? []);
return default;

10
src/OpenIddict.Validation/OpenIddictValidationHandlers.cs

@ -178,7 +178,7 @@ public static partial class OpenIddictValidationHandlers
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) &&
exception is not OperationCanceledException)
{
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219));
context.Logger.LogError(6219, exception, SR.GetResourceString(SR.ID6219));
context.Reject(
error: Errors.ServerError,
@ -625,7 +625,7 @@ public static partial class OpenIddictValidationHandlers
catch (ProtocolException exception)
{
context.Logger.LogDebug(exception, SR.GetResourceString(SR.ID6155));
context.Logger.LogDebug(6155, exception, SR.GetResourceString(SR.ID6155));
context.Reject(
error: exception.Error,
@ -635,7 +635,7 @@ public static partial class OpenIddictValidationHandlers
return;
}
context.Logger.LogTrace(SR.GetResourceString(SR.ID6154), context.AccessToken, context.AccessTokenPrincipal.Claims);
context.Logger.LogTrace(6154, SR.GetResourceString(SR.ID6154), context.AccessToken, context.AccessTokenPrincipal.Claims);
}
}
@ -731,7 +731,7 @@ public static partial class OpenIddictValidationHandlers
var audiences = context.AccessTokenPrincipal.GetAudiences();
if (audiences.IsDefaultOrEmpty)
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6157));
context.Logger.LogInformation(6157, SR.GetResourceString(SR.ID6157));
context.Reject(
error: Errors.InvalidToken,
@ -744,7 +744,7 @@ public static partial class OpenIddictValidationHandlers
// If the access token doesn't include any registered audience, return an error.
if (!audiences.Intersect(context.Options.Audiences, StringComparer.Ordinal).Any())
{
context.Logger.LogInformation(SR.GetResourceString(SR.ID6158));
context.Logger.LogInformation(6158, SR.GetResourceString(SR.ID6158));
context.Reject(
error: Errors.InvalidToken,

12
src/OpenIddict.Validation/OpenIddictValidationService.cs

@ -145,7 +145,7 @@ public class OpenIddictValidationService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6186), context.RemoteUri, context.Request);
context.Logger.LogInformation(6186, SR.GetResourceString(SR.ID6186), context.RemoteUri, context.Request);
return context.Request;
}
@ -169,7 +169,7 @@ public class OpenIddictValidationService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6187), context.RemoteUri, context.Response);
context.Logger.LogInformation(6187, SR.GetResourceString(SR.ID6187), context.RemoteUri, context.Response);
return context.Response;
}
@ -271,7 +271,7 @@ public class OpenIddictValidationService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6188), context.RemoteUri, context.Request);
context.Logger.LogInformation(6188, SR.GetResourceString(SR.ID6188), context.RemoteUri, context.Request);
return context.Request;
}
@ -295,7 +295,7 @@ public class OpenIddictValidationService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6189), context.RemoteUri, context.Response);
context.Logger.LogInformation(6189, SR.GetResourceString(SR.ID6189), context.RemoteUri, context.Response);
return context.Response;
}
@ -414,7 +414,7 @@ public class OpenIddictValidationService
context.Error, context.ErrorDescription, context.ErrorUri);
}
context.Logger.LogInformation(SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
context.Logger.LogInformation(6192, SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request);
return context.Request;
}
@ -440,7 +440,7 @@ public class OpenIddictValidationService
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
context.Logger.LogInformation(SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
context.Logger.LogInformation(6193, SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response);
return context.Response;
}

Loading…
Cancel
Save