Browse Source

Backport the log messages changes to OpenIddict 1.x

pull/553/head
Kévin Chalet 9 years ago
parent
commit
cedb0c968e
  1. 18
      src/OpenIddict/OpenIddictProvider.Exchange.cs
  2. 3
      src/OpenIddict/OpenIddictProvider.Introspection.cs
  3. 3
      src/OpenIddict/OpenIddictProvider.Revocation.cs

18
src/OpenIddict/OpenIddictProvider.Exchange.cs

@ -234,7 +234,8 @@ namespace OpenIddict
var token = await tokens.FindByIdAsync(identifier, context.HttpContext.RequestAborted);
if (token == null)
{
logger.LogError("The token request was rejected because the authorization code was no longer valid.");
logger.LogError("The token request was rejected because the authorization " +
"code '{Identifier}' was not found in the database.", identifier);
context.Reject(
error: OpenIdConnectConstants.Errors.InvalidGrant,
@ -269,7 +270,8 @@ namespace OpenIddict
}
}
logger.LogError("The token request was rejected because the authorization code was already redeemed.");
logger.LogError("The token request was rejected because the authorization code " +
"'{Identifier}' has already been redeemed.", identifier);
context.Reject(
error: OpenIdConnectConstants.Errors.InvalidGrant,
@ -280,7 +282,8 @@ namespace OpenIddict
else if (!await tokens.IsValidAsync(token, context.HttpContext.RequestAborted))
{
logger.LogError("The token request was rejected because the authorization code was no longer valid.");
logger.LogError("The token request was rejected because the authorization code " +
"'{Identifier}' was no longer valid.", identifier);
context.Reject(
error: OpenIdConnectConstants.Errors.InvalidGrant,
@ -299,7 +302,8 @@ namespace OpenIddict
var token = await tokens.FindByIdAsync(identifier, context.HttpContext.RequestAborted);
if (token == null)
{
logger.LogError("The token request was rejected because the refresh token was already redeemed.");
logger.LogError("The token request was rejected because the refresh token " +
"'{Identifier}' was not found in the database.", identifier);
context.Reject(
error: OpenIdConnectConstants.Errors.InvalidGrant,
@ -310,7 +314,8 @@ namespace OpenIddict
else if (await tokens.IsRedeemedAsync(token, context.HttpContext.RequestAborted))
{
logger.LogError("The token request was rejected because the refresh token was no longer valid.");
logger.LogError("The token request was rejected because the refresh token " +
"'{Identifier}' has already been redeemed.", identifier);
context.Reject(
error: OpenIdConnectConstants.Errors.InvalidGrant,
@ -321,7 +326,8 @@ namespace OpenIddict
else if (!await tokens.IsValidAsync(token, context.HttpContext.RequestAborted))
{
logger.LogError("The token request was rejected because the refresh token was no longer valid.");
logger.LogError("The token request was rejected because the refresh token " +
"'{Identifier}' was no longer valid.", identifier);
context.Reject(
error: OpenIdConnectConstants.Errors.InvalidGrant,

3
src/OpenIddict/OpenIddictProvider.Introspection.cs

@ -137,8 +137,7 @@ namespace OpenIddict
var token = await tokens.FindByIdAsync(identifier, context.HttpContext.RequestAborted);
if (token == null || !await tokens.IsValidAsync(token, context.HttpContext.RequestAborted))
{
logger.LogInformation("The token {Identifier} was declared as inactive because " +
"it was revoked.", identifier);
logger.LogInformation("The token '{Identifier}' was declared as inactive because it was revoked.", identifier);
context.Active = false;

3
src/OpenIddict/OpenIddictProvider.Revocation.cs

@ -193,7 +193,8 @@ namespace OpenIddict
var token = await tokens.FindByIdAsync(identifier, context.HttpContext.RequestAborted);
if (token == null || await tokens.IsRevokedAsync(token, context.HttpContext.RequestAborted))
{
logger.LogInformation("The token '{Identifier}' was already revoked.", identifier);
logger.LogInformation("The token '{Identifier}' was not revoked because " +
"it was already marked as invalid.", identifier);
context.Revoked = true;

Loading…
Cancel
Save