Add log event name for security projects (#6420)

This commit is contained in:
Kahbazi 2019-01-07 23:41:09 +03:30 committed by James Newton-King
parent 11b531c189
commit f2e6e6ff33
11 changed files with 160 additions and 158 deletions

View File

@ -334,7 +334,7 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
var shouldRedirect = Options.LoginPath.HasValue && OriginalPath == Options.LoginPath; var shouldRedirect = Options.LoginPath.HasValue && OriginalPath == Options.LoginPath;
await ApplyHeaders(shouldRedirect, signedInContext.Properties); await ApplyHeaders(shouldRedirect, signedInContext.Properties);
Logger.SignedIn(Scheme.Name); Logger.AuthenticationSchemeSignedIn(Scheme.Name);
} }
protected async override Task HandleSignOutAsync(AuthenticationProperties properties) protected async override Task HandleSignOutAsync(AuthenticationProperties properties)
@ -369,7 +369,7 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
var shouldRedirect = Options.LogoutPath.HasValue && OriginalPath == Options.LogoutPath; var shouldRedirect = Options.LogoutPath.HasValue && OriginalPath == Options.LogoutPath;
await ApplyHeaders(shouldRedirect, context.Properties); await ApplyHeaders(shouldRedirect, context.Properties);
Logger.SignedOut(Scheme.Name); Logger.AuthenticationSchemeSignedOut(Scheme.Name);
} }
private async Task ApplyHeaders(bool shouldRedirectToReturnUrl, AuthenticationProperties properties) private async Task ApplyHeaders(bool shouldRedirectToReturnUrl, AuthenticationProperties properties)

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -7,29 +7,29 @@ namespace Microsoft.Extensions.Logging
{ {
internal static class LoggingExtensions internal static class LoggingExtensions
{ {
private static Action<ILogger, string, Exception> _authSchemeSignedIn; private static Action<ILogger, string, Exception> _authenticationSchemeSignedIn;
private static Action<ILogger, string, Exception> _authSchemeSignedOut; private static Action<ILogger, string, Exception> _authenticationSchemeSignedOut;
static LoggingExtensions() static LoggingExtensions()
{ {
_authSchemeSignedIn = LoggerMessage.Define<string>( _authenticationSchemeSignedIn = LoggerMessage.Define<string>(
eventId: 10, eventId: new EventId(10, "AuthenticationSchemeSignedIn"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "AuthenticationScheme: {AuthenticationScheme} signed in."); formatString: "AuthenticationScheme: {AuthenticationScheme} signed in.");
_authSchemeSignedOut = LoggerMessage.Define<string>( _authenticationSchemeSignedOut = LoggerMessage.Define<string>(
eventId: 11, eventId: new EventId(11, "AuthenticationSchemeSignedOut"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "AuthenticationScheme: {AuthenticationScheme} signed out."); formatString: "AuthenticationScheme: {AuthenticationScheme} signed out.");
} }
public static void SignedIn(this ILogger logger, string authenticationScheme) public static void AuthenticationSchemeSignedIn(this ILogger logger, string authenticationScheme)
{ {
_authSchemeSignedIn(logger, authenticationScheme, null); _authenticationSchemeSignedIn(logger, authenticationScheme, null);
} }
public static void SignedOut(this ILogger logger, string authenticationScheme) public static void AuthenticationSchemeSignedOut(this ILogger logger, string authenticationScheme)
{ {
_authSchemeSignedOut(logger, authenticationScheme, null); _authenticationSchemeSignedOut(logger, authenticationScheme, null);
} }
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -7,11 +7,11 @@ namespace Microsoft.Extensions.Logging
{ {
internal static class LoggingExtensions internal static class LoggingExtensions
{ {
private static readonly Action<ILogger, string, Exception> _authSchemeAuthenticated; private static readonly Action<ILogger, string, Exception> _authenticationSchemeAuthenticated;
private static readonly Action<ILogger, string, Exception> _authSchemeNotAuthenticated; private static readonly Action<ILogger, string, Exception> _authenticationSchemeNotAuthenticated;
private static readonly Action<ILogger, string, string, Exception> _authSchemeNotAuthenticatedWithFailure; private static readonly Action<ILogger, string, string, Exception> _authenticationSchemeNotAuthenticatedWithFailure;
private static readonly Action<ILogger, string, Exception> _authSchemeChallenged; private static readonly Action<ILogger, string, Exception> _authenticationSchemeChallenged;
private static readonly Action<ILogger, string, Exception> _authSchemeForbidden; private static readonly Action<ILogger, string, Exception> _authenticationSchemeForbidden;
private static readonly Action<ILogger, string, Exception> _remoteAuthenticationError; private static readonly Action<ILogger, string, Exception> _remoteAuthenticationError;
private static readonly Action<ILogger, Exception> _signInHandled; private static readonly Action<ILogger, Exception> _signInHandled;
private static readonly Action<ILogger, Exception> _signInSkipped; private static readonly Action<ILogger, Exception> _signInSkipped;
@ -25,86 +25,86 @@ namespace Microsoft.Extensions.Logging
static LoggingExtensions() static LoggingExtensions()
{ {
_remoteAuthenticationError = LoggerMessage.Define<string>( _remoteAuthenticationError = LoggerMessage.Define<string>(
eventId: 4, eventId: new EventId(4, "RemoteAuthenticationFailed"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Error from RemoteAuthentication: {ErrorMessage}."); formatString: "Error from RemoteAuthentication: {ErrorMessage}.");
_signInHandled = LoggerMessage.Define( _signInHandled = LoggerMessage.Define(
eventId: 5, eventId: new EventId(5, "SignInHandled"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "The SigningIn event returned Handled."); formatString: "The SigningIn event returned Handled.");
_signInSkipped = LoggerMessage.Define( _signInSkipped = LoggerMessage.Define(
eventId: 6, eventId: new EventId(6, "SignInSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "The SigningIn event returned Skipped."); formatString: "The SigningIn event returned Skipped.");
_authSchemeNotAuthenticatedWithFailure = LoggerMessage.Define<string, string>( _authenticationSchemeNotAuthenticatedWithFailure = LoggerMessage.Define<string, string>(
eventId: 7, eventId: new EventId(7, "AuthenticationSchemeNotAuthenticatedWithFailure"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "{AuthenticationScheme} was not authenticated. Failure message: {FailureMessage}"); formatString: "{AuthenticationScheme} was not authenticated. Failure message: {FailureMessage}");
_authSchemeAuthenticated = LoggerMessage.Define<string>( _authenticationSchemeAuthenticated = LoggerMessage.Define<string>(
eventId: 8, eventId: new EventId(8, "AuthenticationSchemeAuthenticated"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "AuthenticationScheme: {AuthenticationScheme} was successfully authenticated."); formatString: "AuthenticationScheme: {AuthenticationScheme} was successfully authenticated.");
_authSchemeNotAuthenticated = LoggerMessage.Define<string>( _authenticationSchemeNotAuthenticated = LoggerMessage.Define<string>(
eventId: 9, eventId: new EventId(9, "AuthenticationSchemeNotAuthenticated"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "AuthenticationScheme: {AuthenticationScheme} was not authenticated."); formatString: "AuthenticationScheme: {AuthenticationScheme} was not authenticated.");
_authSchemeChallenged = LoggerMessage.Define<string>( _authenticationSchemeChallenged = LoggerMessage.Define<string>(
eventId: 12, eventId: new EventId(12, "AuthenticationSchemeChallenged"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "AuthenticationScheme: {AuthenticationScheme} was challenged."); formatString: "AuthenticationScheme: {AuthenticationScheme} was challenged.");
_authSchemeForbidden = LoggerMessage.Define<string>( _authenticationSchemeForbidden = LoggerMessage.Define<string>(
eventId: 13, eventId: new EventId(13, "AuthenticationSchemeForbidden"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "AuthenticationScheme: {AuthenticationScheme} was forbidden."); formatString: "AuthenticationScheme: {AuthenticationScheme} was forbidden.");
_correlationPropertyNotFound = LoggerMessage.Define<string>( _correlationPropertyNotFound = LoggerMessage.Define<string>(
eventId: 14, eventId: new EventId(14, "CorrelationPropertyNotFound"),
logLevel: LogLevel.Warning, logLevel: LogLevel.Warning,
formatString: "{CorrelationProperty} state property not found."); formatString: "{CorrelationProperty} state property not found.");
_correlationCookieNotFound = LoggerMessage.Define<string>( _correlationCookieNotFound = LoggerMessage.Define<string>(
eventId: 15, eventId: new EventId(15, "CorrelationCookieNotFound"),
logLevel: LogLevel.Warning, logLevel: LogLevel.Warning,
formatString: "'{CorrelationCookieName}' cookie not found."); formatString: "'{CorrelationCookieName}' cookie not found.");
_unexpectedCorrelationCookieValue = LoggerMessage.Define<string, string>( _unexpectedCorrelationCookieValue = LoggerMessage.Define<string, string>(
eventId: 16, eventId: new EventId(16, "UnexpectedCorrelationCookieValue"),
logLevel: LogLevel.Warning, logLevel: LogLevel.Warning,
formatString: "The correlation cookie value '{CorrelationCookieName}' did not match the expected value '{CorrelationCookieValue}'."); formatString: "The correlation cookie value '{CorrelationCookieName}' did not match the expected value '{CorrelationCookieValue}'.");
_accessDeniedError = LoggerMessage.Define( _accessDeniedError = LoggerMessage.Define(
eventId: 17, eventId: new EventId(17, "AccessDenied"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Access was denied by the resource owner or by the remote server."); formatString: "Access was denied by the resource owner or by the remote server.");
_accessDeniedContextHandled = LoggerMessage.Define( _accessDeniedContextHandled = LoggerMessage.Define(
eventId: 18, eventId: new EventId(18, "AccessDeniedContextHandled"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "The AccessDenied event returned Handled."); formatString: "The AccessDenied event returned Handled.");
_accessDeniedContextSkipped = LoggerMessage.Define( _accessDeniedContextSkipped = LoggerMessage.Define(
eventId: 19, eventId: new EventId(19, "AccessDeniedContextSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "The AccessDenied event returned Skipped."); formatString: "The AccessDenied event returned Skipped.");
} }
public static void AuthenticationSchemeAuthenticated(this ILogger logger, string authenticationScheme) public static void AuthenticationSchemeAuthenticated(this ILogger logger, string authenticationScheme)
{ {
_authSchemeAuthenticated(logger, authenticationScheme, null); _authenticationSchemeAuthenticated(logger, authenticationScheme, null);
} }
public static void AuthenticationSchemeNotAuthenticated(this ILogger logger, string authenticationScheme) public static void AuthenticationSchemeNotAuthenticated(this ILogger logger, string authenticationScheme)
{ {
_authSchemeNotAuthenticated(logger, authenticationScheme, null); _authenticationSchemeNotAuthenticated(logger, authenticationScheme, null);
} }
public static void AuthenticationSchemeNotAuthenticatedWithFailure(this ILogger logger, string authenticationScheme, string failureMessage) public static void AuthenticationSchemeNotAuthenticatedWithFailure(this ILogger logger, string authenticationScheme, string failureMessage)
{ {
_authSchemeNotAuthenticatedWithFailure(logger, authenticationScheme, failureMessage, null); _authenticationSchemeNotAuthenticatedWithFailure(logger, authenticationScheme, failureMessage, null);
} }
public static void AuthenticationSchemeChallenged(this ILogger logger, string authenticationScheme) public static void AuthenticationSchemeChallenged(this ILogger logger, string authenticationScheme)
{ {
_authSchemeChallenged(logger, authenticationScheme, null); _authenticationSchemeChallenged(logger, authenticationScheme, null);
} }
public static void AuthenticationSchemeForbidden(this ILogger logger, string authenticationScheme) public static void AuthenticationSchemeForbidden(this ILogger logger, string authenticationScheme)
{ {
_authSchemeForbidden(logger, authenticationScheme, null); _authenticationSchemeForbidden(logger, authenticationScheme, null);
} }
public static void RemoteAuthenticationError(this ILogger logger, string errorMessage) public static void RemoteAuthenticationError(this ILogger logger, string errorMessage)
@ -112,12 +112,12 @@ namespace Microsoft.Extensions.Logging
_remoteAuthenticationError(logger, errorMessage, null); _remoteAuthenticationError(logger, errorMessage, null);
} }
public static void SigninHandled(this ILogger logger) public static void SignInHandled(this ILogger logger)
{ {
_signInHandled(logger, null); _signInHandled(logger, null);
} }
public static void SigninSkipped(this ILogger logger) public static void SignInSkipped(this ILogger logger)
{ {
_signInSkipped(logger, null); _signInSkipped(logger, null);
} }

View File

@ -127,12 +127,12 @@ namespace Microsoft.AspNetCore.Authentication
{ {
if (ticketContext.Result.Handled) if (ticketContext.Result.Handled)
{ {
Logger.SigninHandled(); Logger.SignInHandled();
return true; return true;
} }
else if (ticketContext.Result.Skipped) else if (ticketContext.Result.Skipped)
{ {
Logger.SigninSkipped(); Logger.SignInSkipped();
return false; return false;
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -14,15 +14,15 @@ namespace Microsoft.Extensions.Logging
static LoggingExtensions() static LoggingExtensions()
{ {
_tokenValidationFailed = LoggerMessage.Define( _tokenValidationFailed = LoggerMessage.Define(
eventId: 1, eventId: new EventId(1, "TokenValidationFailed"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Failed to validate the token."); formatString: "Failed to validate the token.");
_tokenValidationSucceeded = LoggerMessage.Define( _tokenValidationSucceeded = LoggerMessage.Define(
eventId: 2, eventId: new EventId(2, "TokenValidationSucceeded"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Successfully validated the token."); formatString: "Successfully validated the token.");
_errorProcessingMessage = LoggerMessage.Define( _errorProcessingMessage = LoggerMessage.Define(
eventId: 3, eventId: new EventId(3, "ProcessingMessageFailed"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "Exception occurred while processing message."); formatString: "Exception occurred while processing message.");
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -9,8 +9,8 @@ namespace Microsoft.Extensions.Logging
{ {
private static Action<ILogger, Exception> _redirectToIdentityProviderForSignOutHandledResponse; private static Action<ILogger, Exception> _redirectToIdentityProviderForSignOutHandledResponse;
private static Action<ILogger, Exception> _redirectToIdentityProviderHandledResponse; private static Action<ILogger, Exception> _redirectToIdentityProviderHandledResponse;
private static Action<ILogger, Exception> _signoutCallbackRedirectHandledResponse; private static Action<ILogger, Exception> _signOutCallbackRedirectHandledResponse;
private static Action<ILogger, Exception> _signoutCallbackRedirectSkipped; private static Action<ILogger, Exception> _signOutCallbackRedirectSkipped;
private static Action<ILogger, Exception> _updatingConfiguration; private static Action<ILogger, Exception> _updatingConfiguration;
private static Action<ILogger, Exception> _receivedIdToken; private static Action<ILogger, Exception> _receivedIdToken;
private static Action<ILogger, Exception> _redeemingCodeForTokens; private static Action<ILogger, Exception> _redeemingCodeForTokens;
@ -55,209 +55,211 @@ namespace Microsoft.Extensions.Logging
private static Action<ILogger, Exception> _remoteSignOut; private static Action<ILogger, Exception> _remoteSignOut;
private static Action<ILogger, Exception> _remoteSignOutSessionIdMissing; private static Action<ILogger, Exception> _remoteSignOutSessionIdMissing;
private static Action<ILogger, Exception> _remoteSignOutSessionIdInvalid; private static Action<ILogger, Exception> _remoteSignOutSessionIdInvalid;
private static Action<ILogger, string, Exception> _signOut; private static Action<ILogger, string, Exception> _authenticationSchemeSignedOut;
static LoggingExtensions() static LoggingExtensions()
{ {
// Final // Final
_redirectToIdentityProviderForSignOutHandledResponse = LoggerMessage.Define( _redirectToIdentityProviderForSignOutHandledResponse = LoggerMessage.Define(
eventId: 1, eventId: new EventId(1, "RedirectToIdentityProviderForSignOutHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RedirectToIdentityProviderForSignOut.HandledResponse"); formatString: "RedirectToIdentityProviderForSignOut.HandledResponse");
_invalidLogoutQueryStringRedirectUrl = LoggerMessage.Define<string>( _invalidLogoutQueryStringRedirectUrl = LoggerMessage.Define<string>(
eventId: 3, eventId: new EventId(3, "InvalidLogoutQueryStringRedirectUrl"),
logLevel: LogLevel.Warning, logLevel: LogLevel.Warning,
formatString: "The query string for Logout is not a well-formed URI. Redirect URI: '{RedirectUrl}'."); formatString: "The query string for Logout is not a well-formed URI. Redirect URI: '{RedirectUrl}'.");
_enteringOpenIdAuthenticationHandlerHandleUnauthorizedAsync = LoggerMessage.Define<string>( _enteringOpenIdAuthenticationHandlerHandleUnauthorizedAsync = LoggerMessage.Define<string>(
eventId: 4, eventId: new EventId(4, "EnteringOpenIdAuthenticationHandlerHandleUnauthorizedAsync"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Entering {OpenIdConnectHandlerType}'s HandleUnauthorizedAsync."); formatString: "Entering {OpenIdConnectHandlerType}'s HandleUnauthorizedAsync.");
_enteringOpenIdAuthenticationHandlerHandleSignOutAsync = LoggerMessage.Define<string>( _enteringOpenIdAuthenticationHandlerHandleSignOutAsync = LoggerMessage.Define<string>(
eventId: 14, eventId: new EventId(14, "EnteringOpenIdAuthenticationHandlerHandleSignOutAsync"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Entering {OpenIdConnectHandlerType}'s HandleSignOutAsync."); formatString: "Entering {OpenIdConnectHandlerType}'s HandleSignOutAsync.");
_postAuthenticationLocalRedirect = LoggerMessage.Define<string>( _postAuthenticationLocalRedirect = LoggerMessage.Define<string>(
eventId: 5, eventId: new EventId(5, "PostAuthenticationLocalRedirect"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Using properties.RedirectUri for 'local redirect' post authentication: '{RedirectUri}'."); formatString: "Using properties.RedirectUri for 'local redirect' post authentication: '{RedirectUri}'.");
_redirectToIdentityProviderHandledResponse = LoggerMessage.Define( _redirectToIdentityProviderHandledResponse = LoggerMessage.Define(
eventId: 6, eventId: new EventId(6, "RedirectToIdentityProviderHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RedirectToIdentityProvider.HandledResponse"); formatString: "RedirectToIdentityProvider.HandledResponse");
_invalidAuthenticationRequestUrl = LoggerMessage.Define<string>( _invalidAuthenticationRequestUrl = LoggerMessage.Define<string>(
eventId: 8, eventId: new EventId(8, "InvalidAuthenticationRequestUrl"),
logLevel: LogLevel.Warning, logLevel: LogLevel.Warning,
formatString: "The redirect URI is not well-formed. The URI is: '{AuthenticationRequestUrl}'."); formatString: "The redirect URI is not well-formed. The URI is: '{AuthenticationRequestUrl}'.");
_enteringOpenIdAuthenticationHandlerHandleRemoteAuthenticateAsync = LoggerMessage.Define<string>( _enteringOpenIdAuthenticationHandlerHandleRemoteAuthenticateAsync = LoggerMessage.Define<string>(
eventId: 9, eventId: new EventId(9, "EnteringOpenIdAuthenticationHandlerHandleRemoteAuthenticateAsync"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Entering {OpenIdConnectHandlerType}'s HandleRemoteAuthenticateAsync."); formatString: "Entering {OpenIdConnectHandlerType}'s HandleRemoteAuthenticateAsync.");
_nullOrEmptyAuthorizationResponseState = LoggerMessage.Define( _nullOrEmptyAuthorizationResponseState = LoggerMessage.Define(
eventId: 10, eventId: new EventId(10, "NullOrEmptyAuthorizationResponseState"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "message.State is null or empty."); formatString: "message.State is null or empty.");
_unableToReadAuthorizationResponseState = LoggerMessage.Define( _unableToReadAuthorizationResponseState = LoggerMessage.Define(
eventId: 11, eventId: new EventId(11, "UnableToReadAuthorizationResponseState"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "Unable to read the message.State."); formatString: "Unable to read the message.State.");
_responseError = LoggerMessage.Define<string, string, string>( _responseError = LoggerMessage.Define<string, string, string>(
eventId: 12, eventId: new EventId(12, "ResponseError"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "Message contains error: '{Error}', error_description: '{ErrorDescription}', error_uri: '{ErrorUri}'."); formatString: "Message contains error: '{Error}', error_description: '{ErrorDescription}', error_uri: '{ErrorUri}'.");
_responseErrorWithStatusCode = LoggerMessage.Define<string, string, string, int>( _responseErrorWithStatusCode = LoggerMessage.Define<string, string, string, int>(
eventId: 49, eventId: new EventId(52, "ResponseErrorWithStatusCode"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "Message contains error: '{Error}', error_description: '{ErrorDescription}', error_uri: '{ErrorUri}', status code '{StatusCode}'."); formatString: "Message contains error: '{Error}', error_description: '{ErrorDescription}', error_uri: '{ErrorUri}', status code '{StatusCode}'.");
_updatingConfiguration = LoggerMessage.Define( _updatingConfiguration = LoggerMessage.Define(
eventId: 13, eventId: new EventId(13, "UpdatingConfiguration"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "Updating configuration"); formatString: "Updating configuration");
_tokenValidatedHandledResponse = LoggerMessage.Define( _tokenValidatedHandledResponse = LoggerMessage.Define(
eventId: 15, eventId: new EventId(15, "TokenValidatedHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "TokenValidated.HandledResponse"); formatString: "TokenValidated.HandledResponse");
_tokenValidatedSkipped = LoggerMessage.Define( _tokenValidatedSkipped = LoggerMessage.Define(
eventId: 16, eventId: new EventId(16, "TokenValidatedSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "TokenValidated.Skipped"); formatString: "TokenValidated.Skipped");
_exceptionProcessingMessage = LoggerMessage.Define( _exceptionProcessingMessage = LoggerMessage.Define(
eventId: 17, eventId: new EventId(17, "ExceptionProcessingMessage"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "Exception occurred while processing message."); formatString: "Exception occurred while processing message.");
_configurationManagerRequestRefreshCalled = LoggerMessage.Define( _configurationManagerRequestRefreshCalled = LoggerMessage.Define(
eventId: 18, eventId: new EventId(18, "ConfigurationManagerRequestRefreshCalled"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "Exception of type 'SecurityTokenSignatureKeyNotFoundException' thrown, Options.ConfigurationManager.RequestRefresh() called."); formatString: "Exception of type 'SecurityTokenSignatureKeyNotFoundException' thrown, Options.ConfigurationManager.RequestRefresh() called.");
_redeemingCodeForTokens = LoggerMessage.Define( _redeemingCodeForTokens = LoggerMessage.Define(
eventId: 19, eventId: new EventId(19, "RedeemingCodeForTokens"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "Redeeming code for tokens."); formatString: "Redeeming code for tokens.");
_retrievingClaims = LoggerMessage.Define( _retrievingClaims = LoggerMessage.Define(
eventId: 20, eventId: new EventId(20, "RetrievingClaims"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Retrieving claims from the user info endpoint."); formatString: "Retrieving claims from the user info endpoint.");
_receivedIdToken = LoggerMessage.Define( _receivedIdToken = LoggerMessage.Define(
eventId: 21, eventId: new EventId(21, "ReceivedIdToken"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "Received 'id_token'"); formatString: "Received 'id_token'");
_userInfoEndpointNotSet = LoggerMessage.Define( _userInfoEndpointNotSet = LoggerMessage.Define(
eventId: 22, eventId: new EventId(22, "UserInfoEndpointNotSet"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "UserInfoEndpoint is not set. Claims cannot be retrieved."); formatString: "UserInfoEndpoint is not set. Claims cannot be retrieved.");
_unableToProtectNonceCookie = LoggerMessage.Define( _unableToProtectNonceCookie = LoggerMessage.Define(
eventId: 23, eventId: new EventId(23, "UnableToProtectNonceCookie"),
logLevel: LogLevel.Warning, logLevel: LogLevel.Warning,
formatString: "Failed to un-protect the nonce cookie."); formatString: "Failed to un-protect the nonce cookie.");
_messageReceived = LoggerMessage.Define<string>( _messageReceived = LoggerMessage.Define<string>(
eventId: 24, eventId: new EventId(24, "MessageReceived"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "MessageReceived: '{RedirectUrl}'."); formatString: "MessageReceived: '{RedirectUrl}'.");
_messageReceivedContextHandledResponse = LoggerMessage.Define( _messageReceivedContextHandledResponse = LoggerMessage.Define(
eventId: 25, eventId: new EventId(25, "MessageReceivedContextHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "MessageReceivedContext.HandledResponse"); formatString: "MessageReceivedContext.HandledResponse");
_messageReceivedContextSkipped = LoggerMessage.Define( _messageReceivedContextSkipped = LoggerMessage.Define(
eventId: 26, eventId: new EventId(26, "MessageReceivedContextSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "MessageReceivedContext.Skipped"); formatString: "MessageReceivedContext.Skipped");
_authorizationCodeReceived = LoggerMessage.Define( _authorizationCodeReceived = LoggerMessage.Define(
eventId: 27, eventId: new EventId(27, "AuthorizationCodeReceived"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Authorization code received."); formatString: "Authorization code received.");
_authorizationCodeReceivedContextHandledResponse = LoggerMessage.Define( _authorizationCodeReceivedContextHandledResponse = LoggerMessage.Define(
eventId: 28, eventId: new EventId(28, "AuthorizationCodeReceivedContextHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "AuthorizationCodeReceivedContext.HandledResponse"); formatString: "AuthorizationCodeReceivedContext.HandledResponse");
_authorizationCodeReceivedContextSkipped = LoggerMessage.Define( _authorizationCodeReceivedContextSkipped = LoggerMessage.Define(
eventId: 29, eventId: new EventId(29, "AuthorizationCodeReceivedContextSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "AuthorizationCodeReceivedContext.Skipped"); formatString: "AuthorizationCodeReceivedContext.Skipped");
_tokenResponseReceived = LoggerMessage.Define( _tokenResponseReceived = LoggerMessage.Define(
eventId: 30, eventId: new EventId(30, "TokenResponseReceived"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Token response received."); formatString: "Token response received.");
_tokenResponseReceivedHandledResponse = LoggerMessage.Define( _tokenResponseReceivedHandledResponse = LoggerMessage.Define(
eventId: 31, eventId: new EventId(31, "TokenResponseReceivedHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "TokenResponseReceived.HandledResponse"); formatString: "TokenResponseReceived.HandledResponse");
_tokenResponseReceivedSkipped = LoggerMessage.Define( _tokenResponseReceivedSkipped = LoggerMessage.Define(
eventId: 32, eventId: new EventId(32, "TokenResponseReceivedSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "TokenResponseReceived.Skipped"); formatString: "TokenResponseReceived.Skipped");
_postSignOutRedirect = LoggerMessage.Define<string>( _postSignOutRedirect = LoggerMessage.Define<string>(
eventId: 33, eventId: new EventId(33, "PostSignOutRedirect"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "Using properties.RedirectUri for redirect post authentication: '{RedirectUri}'."); formatString: "Using properties.RedirectUri for redirect post authentication: '{RedirectUri}'.");
_userInformationReceived = LoggerMessage.Define<string>( _userInformationReceived = LoggerMessage.Define<string>(
eventId: 35, eventId: new EventId(35, "UserInformationReceived"),
logLevel: LogLevel.Trace, logLevel: LogLevel.Trace,
formatString: "User information received: {User}"); formatString: "User information received: {User}");
_userInformationReceivedHandledResponse = LoggerMessage.Define( _userInformationReceivedHandledResponse = LoggerMessage.Define(
eventId: 36, eventId: new EventId(36, "UserInformationReceivedHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "The UserInformationReceived event returned Handled."); formatString: "The UserInformationReceived event returned Handled.");
_userInformationReceivedSkipped = LoggerMessage.Define( _userInformationReceivedSkipped = LoggerMessage.Define(
eventId: 37, eventId: new EventId(37, "UserInformationReceivedSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "The UserInformationReceived event returned Skipped."); formatString: "The UserInformationReceived event returned Skipped.");
_authenticationFailedContextHandledResponse = LoggerMessage.Define( _authenticationFailedContextHandledResponse = LoggerMessage.Define(
eventId: 38, eventId: new EventId(38, "AuthenticationFailedContextHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "AuthenticationFailedContext.HandledResponse"); formatString: "AuthenticationFailedContext.HandledResponse");
_authenticationFailedContextSkipped = LoggerMessage.Define( _authenticationFailedContextSkipped = LoggerMessage.Define(
eventId: 39, eventId: new EventId(39, "AuthenticationFailedContextSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "AuthenticationFailedContext.Skipped"); formatString: "AuthenticationFailedContext.Skipped");
_invalidSecurityTokenType = LoggerMessage.Define<string>( _invalidSecurityTokenType = LoggerMessage.Define<string>(
eventId: 40, eventId: new EventId(40, "InvalidSecurityTokenType"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "The Validated Security Token must be of type JwtSecurityToken, but instead its type is: '{SecurityTokenType}'"); formatString: "The Validated Security Token must be of type JwtSecurityToken, but instead its type is: '{SecurityTokenType}'");
_unableToValidateIdToken = LoggerMessage.Define<string>( _unableToValidateIdToken = LoggerMessage.Define<string>(
eventId: 41, eventId: new EventId(41, "UnableToValidateIdToken"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "Unable to validate the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'."); formatString: "Unable to validate the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'.");
_accessTokenNotAvailable = LoggerMessage.Define( _accessTokenNotAvailable = LoggerMessage.Define(
eventId: 42, eventId: new EventId(42, "AccessTokenNotAvailable"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "The access_token is not available. Claims cannot be retrieved."); formatString: "The access_token is not available. Claims cannot be retrieved.");
_unableToReadIdToken = LoggerMessage.Define<string>( _unableToReadIdToken = LoggerMessage.Define<string>(
eventId: 43, eventId: new EventId(43, "UnableToReadIdToken"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "Unable to read the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'."); formatString: "Unable to read the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'.");
_remoteSignOutHandledResponse = LoggerMessage.Define( _remoteSignOutHandledResponse = LoggerMessage.Define(
eventId: 44, eventId: new EventId(44, "RemoteSignOutHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RemoteSignOutContext.HandledResponse"); formatString: "RemoteSignOutContext.HandledResponse");
_remoteSignOutSkipped = LoggerMessage.Define( _remoteSignOutSkipped = LoggerMessage.Define(
eventId: 45, eventId: new EventId(45, "RemoteSignOutSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RemoteSignOutContext.Skipped"); formatString: "RemoteSignOutContext.Skipped");
_remoteSignOut = LoggerMessage.Define( _remoteSignOut = LoggerMessage.Define(
eventId: 46, eventId: new EventId(46, "RemoteSignOut"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Remote signout request processed."); formatString: "Remote signout request processed.");
_remoteSignOutSessionIdMissing = LoggerMessage.Define( _remoteSignOutSessionIdMissing = LoggerMessage.Define(
eventId: 47, eventId: new EventId(47, "RemoteSignOutSessionIdMissing"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "The remote signout request was ignored because the 'sid' parameter " + formatString: "The remote signout request was ignored because the 'sid' parameter " +
"was missing, which may indicate an unsolicited logout."); "was missing, which may indicate an unsolicited logout.");
_remoteSignOutSessionIdInvalid = LoggerMessage.Define( _remoteSignOutSessionIdInvalid = LoggerMessage.Define(
eventId: 48, eventId: new EventId(48, "RemoteSignOutSessionIdInvalid"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "The remote signout request was ignored because the 'sid' parameter didn't match " + formatString: "The remote signout request was ignored because the 'sid' parameter didn't match " +
"the expected value, which may indicate an unsolicited logout."); "the expected value, which may indicate an unsolicited logout.");
_signOut = LoggerMessage.Define<string>( _authenticationSchemeSignedOut = LoggerMessage.Define<string>(
eventId: 49, eventId: new EventId(49, "AuthenticationSchemeSignedOut"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "AuthenticationScheme: {AuthenticationScheme} signed out."); formatString: "AuthenticationScheme: {AuthenticationScheme} signed out.");
_signoutCallbackRedirectHandledResponse = LoggerMessage.Define( _signOutCallbackRedirectHandledResponse = LoggerMessage.Define(
eventId: 50, eventId: new EventId(50, "SignOutCallbackRedirectHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RedirectToSignedOutRedirectUri.HandledResponse"); formatString: "RedirectToSignedOutRedirectUri.HandledResponse");
_signoutCallbackRedirectSkipped = LoggerMessage.Define( _signOutCallbackRedirectSkipped = LoggerMessage.Define(
eventId: 51, eventId: new EventId(51, "SignOutCallbackRedirectSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RedirectToSignedOutRedirectUri.Skipped"); formatString: "RedirectToSignedOutRedirectUri.Skipped");
// EventId 52 is used by ResponseErrorWithStatusCode
} }
public static void UpdatingConfiguration(this ILogger logger) public static void UpdatingConfiguration(this ILogger logger)
@ -355,14 +357,14 @@ namespace Microsoft.Extensions.Logging
_redirectToIdentityProviderHandledResponse(logger, null); _redirectToIdentityProviderHandledResponse(logger, null);
} }
public static void SignoutCallbackRedirectHandledResponse(this ILogger logger) public static void SignOutCallbackRedirectHandledResponse(this ILogger logger)
{ {
_signoutCallbackRedirectHandledResponse(logger, null); _signOutCallbackRedirectHandledResponse(logger, null);
} }
public static void SignoutCallbackRedirectSkipped(this ILogger logger) public static void SignOutCallbackRedirectSkipped(this ILogger logger)
{ {
_signoutCallbackRedirectSkipped(logger, null); _signOutCallbackRedirectSkipped(logger, null);
} }
public static void UserInformationReceivedHandledResponse(this ILogger logger) public static void UserInformationReceivedHandledResponse(this ILogger logger)
@ -500,9 +502,9 @@ namespace Microsoft.Extensions.Logging
_remoteSignOutSessionIdInvalid(logger, null); _remoteSignOutSessionIdInvalid(logger, null);
} }
public static void SignedOut(this ILogger logger, string authenticationScheme) public static void AuthenticationSchemeSignedOut(this ILogger logger, string authenticationScheme)
{ {
_signOut(logger, authenticationScheme, null); _authenticationSchemeSignedOut(logger, authenticationScheme, null);
} }
} }
} }

View File

@ -250,7 +250,7 @@ namespace Microsoft.AspNetCore.Authentication.OpenIdConnect
throw new NotImplementedException($"An unsupported authentication method has been configured: {Options.AuthenticationMethod}"); throw new NotImplementedException($"An unsupported authentication method has been configured: {Options.AuthenticationMethod}");
} }
Logger.SignedOut(Scheme.Name); Logger.AuthenticationSchemeSignedOut(Scheme.Name);
} }
/// <summary> /// <summary>
@ -276,12 +276,12 @@ namespace Microsoft.AspNetCore.Authentication.OpenIdConnect
{ {
if (signOut.Result.Handled) if (signOut.Result.Handled)
{ {
Logger.SignoutCallbackRedirectHandledResponse(); Logger.SignOutCallbackRedirectHandledResponse();
return true; return true;
} }
if (signOut.Result.Skipped) if (signOut.Result.Skipped)
{ {
Logger.SignoutCallbackRedirectSkipped(); Logger.SignOutCallbackRedirectSkipped();
return false; return false;
} }
if (signOut.Result.Failure != null) if (signOut.Result.Failure != null)

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -14,15 +14,15 @@ namespace Microsoft.Extensions.Logging
static LoggingExtensions() static LoggingExtensions()
{ {
_obtainRequestToken = LoggerMessage.Define( _obtainRequestToken = LoggerMessage.Define(
eventId: 1, eventId: new EventId(1, "ObtainRequestToken"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "ObtainRequestToken"); formatString: "ObtainRequestToken");
_obtainAccessToken = LoggerMessage.Define( _obtainAccessToken = LoggerMessage.Define(
eventId: 2, eventId: new EventId(2, "ObtainAccessToken"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "ObtainAccessToken"); formatString: "ObtainAccessToken");
_retrieveUserDetails = LoggerMessage.Define( _retrieveUserDetails = LoggerMessage.Define(
eventId: 3, eventId: new EventId(3, "RetrieveUserDetails"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RetrieveUserDetails"); formatString: "RetrieveUserDetails");

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Logging
{ {
internal static class LoggingExtensions internal static class LoggingExtensions
{ {
private static Action<ILogger, Exception> _signInWithoutWresult; private static Action<ILogger, Exception> _signInWithoutWResult;
private static Action<ILogger, Exception> _signInWithoutToken; private static Action<ILogger, Exception> _signInWithoutToken;
private static Action<ILogger, Exception> _exceptionProcessingMessage; private static Action<ILogger, Exception> _exceptionProcessingMessage;
private static Action<ILogger, string, Exception> _malformedRedirectUri; private static Action<ILogger, string, Exception> _malformedRedirectUri;
@ -17,39 +17,39 @@ namespace Microsoft.Extensions.Logging
static LoggingExtensions() static LoggingExtensions()
{ {
_signInWithoutWresult = LoggerMessage.Define( _signInWithoutWResult = LoggerMessage.Define(
eventId: 1, eventId: new EventId(1, "SignInWithoutWResult"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "Received a sign-in message without a WResult."); formatString: "Received a sign-in message without a WResult.");
_signInWithoutToken = LoggerMessage.Define( _signInWithoutToken = LoggerMessage.Define(
eventId: 2, eventId: new EventId(2, "SignInWithoutToken"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "Received a sign-in message without a token."); formatString: "Received a sign-in message without a token.");
_exceptionProcessingMessage = LoggerMessage.Define( _exceptionProcessingMessage = LoggerMessage.Define(
eventId: 3, eventId: new EventId(3, "ExceptionProcessingMessage"),
logLevel: LogLevel.Error, logLevel: LogLevel.Error,
formatString: "Exception occurred while processing message."); formatString: "Exception occurred while processing message.");
_malformedRedirectUri = LoggerMessage.Define<string>( _malformedRedirectUri = LoggerMessage.Define<string>(
eventId: 4, eventId: new EventId(4, "MalformedRedirectUri"),
logLevel: LogLevel.Warning, logLevel: LogLevel.Warning,
formatString: "The sign-out redirect URI '{0}' is malformed."); formatString: "The sign-out redirect URI '{0}' is malformed.");
_remoteSignOutHandledResponse = LoggerMessage.Define( _remoteSignOutHandledResponse = LoggerMessage.Define(
eventId: 5, eventId: new EventId(5, "RemoteSignOutHandledResponse"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RemoteSignOutContext.HandledResponse"); formatString: "RemoteSignOutContext.HandledResponse");
_remoteSignOutSkipped = LoggerMessage.Define( _remoteSignOutSkipped = LoggerMessage.Define(
eventId: 6, eventId: new EventId(6, "RemoteSignOutSkipped"),
logLevel: LogLevel.Debug, logLevel: LogLevel.Debug,
formatString: "RemoteSignOutContext.Skipped"); formatString: "RemoteSignOutContext.Skipped");
_remoteSignOut = LoggerMessage.Define( _remoteSignOut = LoggerMessage.Define(
eventId: 7, eventId: new EventId(7, "RemoteSignOut"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Remote signout request processed."); formatString: "Remote signout request processed.");
} }
public static void SignInWithoutWresult(this ILogger logger) public static void SignInWithoutWResult(this ILogger logger)
{ {
_signInWithoutWresult(logger, null); _signInWithoutWResult(logger, null);
} }
public static void SignInWithoutToken(this ILogger logger) public static void SignInWithoutToken(this ILogger logger)

View File

@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Authentication.WsFederation
if (wsFederationMessage.Wresult == null) if (wsFederationMessage.Wresult == null)
{ {
Logger.SignInWithoutWresult(); Logger.SignInWithoutWResult();
return HandleRequestResult.Fail(Resources.SignInMessageWresultIsMissing, properties); return HandleRequestResult.Fail(Resources.SignInMessageWresultIsMissing, properties);
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -13,11 +13,11 @@ namespace Microsoft.Extensions.Logging
static LoggingExtensions() static LoggingExtensions()
{ {
_userAuthorizationSucceeded = LoggerMessage.Define( _userAuthorizationSucceeded = LoggerMessage.Define(
eventId: 1, eventId: new EventId(1, "UserAuthorizationSucceeded"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Authorization was successful."); formatString: "Authorization was successful.");
_userAuthorizationFailed = LoggerMessage.Define( _userAuthorizationFailed = LoggerMessage.Define(
eventId: 2, eventId: new EventId(2, "UserAuthorizationFailed"),
logLevel: LogLevel.Information, logLevel: LogLevel.Information,
formatString: "Authorization failed."); formatString: "Authorization failed.");
} }