Example #1
0
        static LoggingExtensions()
        {
            _usingFallbackKeyWithExpirationAsDefaultKey = LoggerMessage.Define <Guid, DateTimeOffset>(
                eventId: new EventId(1, "UsingFallbackKeyWithExpirationAsDefaultKey"),
                logLevel: LogLevel.Warning,
                formatString: "Policy resolution states that a new key should be added to the key ring, but automatic generation of keys is disabled. Using fallback key {KeyId:B} with expiration {ExpirationDate:u} as default key.");
            _usingKeyAsDefaultKey = LoggerMessage.Define <Guid>(
                eventId: new EventId(2, "UsingKeyAsDefaultKey"),
                logLevel: LogLevel.Debug,
                formatString: "Using key {KeyId:B} as the default key.");
            _openingCNGAlgorithmFromProviderWithHMAC = LoggerMessage.Define <string, string>(
                eventId: new EventId(3, "OpeningCNGAlgorithmFromProviderWithHMAC"),
                logLevel: LogLevel.Debug,
                formatString: "Opening CNG algorithm '{HashAlgorithm}' from provider '{HashAlgorithmProvider}' with HMAC.");
            _openingCNGAlgorithmFromProviderWithChainingModeCBC = LoggerMessage.Define <string, string>(
                eventId: new EventId(4, "OpeningCNGAlgorithmFromProviderWithChainingModeCBC"),
                logLevel: LogLevel.Debug,
                formatString: "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode CBC.");
            _performingUnprotectOperationToKeyWithPurposes = LoggerMessage.Define <Guid, string>(
                eventId: new EventId(5, "PerformingUnprotectOperationToKeyWithPurposes"),
                logLevel: LogLevel.Trace,
                formatString: "Performing unprotect operation to key {KeyId:B} with purposes {Purposes}.");
            _keyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed = LoggerMessage.Define <Guid>(
                eventId: new EventId(6, "KeyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed"),
                logLevel: LogLevel.Trace,
                formatString: "Key {KeyId:B} was not found in the key ring. Unprotect operation cannot proceed.");
            _keyWasRevokedCallerRequestedUnprotectOperationProceedRegardless = LoggerMessage.Define <Guid>(
                eventId: new EventId(7, "KeyWasRevokedCallerRequestedUnprotectOperationProceedRegardless"),
                logLevel: LogLevel.Debug,
                formatString: "Key {KeyId:B} was revoked. Caller requested unprotect operation proceed regardless.");
            _keyWasRevokedUnprotectOperationCannotProceed = LoggerMessage.Define <Guid>(
                eventId: new EventId(8, "KeyWasRevokedUnprotectOperationCannotProceed"),
                logLevel: LogLevel.Debug,
                formatString: "Key {KeyId:B} was revoked. Unprotect operation cannot proceed.");
            _openingCNGAlgorithmFromProviderWithChainingModeGCM = LoggerMessage.Define <string, string>(
                eventId: new EventId(9, "OpeningCNGAlgorithmFromProviderWithChainingModeGCM"),
                logLevel: LogLevel.Debug,
                formatString: "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode GCM.");
            _usingManagedKeyedHashAlgorithm = LoggerMessage.Define <string>(
                eventId: new EventId(10, "UsingManagedKeyedHashAlgorithm"),
                logLevel: LogLevel.Debug,
                formatString: "Using managed keyed hash algorithm '{FullName}'.");
            _usingManagedSymmetricAlgorithm = LoggerMessage.Define <string>(
                eventId: new EventId(11, "UsingManagedSymmetricAlgorithm"),
                logLevel: LogLevel.Debug,
                formatString: "Using managed symmetric algorithm '{FullName}'.");
            _keyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed = LoggerMessage.Define <Guid, string>(
                eventId: new EventId(12, "KeyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed"),
                logLevel: LogLevel.Warning,
                formatString: "Key {KeyId:B} is ineligible to be the default key because its {MethodName} method failed.");
            _consideringKeyWithExpirationDateAsDefaultKey = LoggerMessage.Define <Guid, DateTimeOffset>(
                eventId: new EventId(13, "ConsideringKeyWithExpirationDateAsDefaultKey"),
                logLevel: LogLevel.Debug,
                formatString: "Considering key {KeyId:B} with expiration date {ExpirationDate:u} as default key.");
            _keyIsNoLongerUnderConsiderationAsDefault = LoggerMessage.Define <Guid>(
                eventId: new EventId(14, "KeyIsNoLongerUnderConsiderationAsDefault"),
                logLevel: LogLevel.Debug,
                formatString: "Key {KeyId:B} is no longer under consideration as default key because it is expired, revoked, or cannot be deciphered.");
            _unknownElementWithNameFoundInKeyringSkipping = LoggerMessage.Define <XName>(
                eventId: new EventId(15, "UnknownElementWithNameFoundInKeyringSkipping"),
                logLevel: LogLevel.Warning,
                formatString: "Unknown element with name '{Name}' found in keyring, skipping.");
            _markedKeyAsRevokedInTheKeyring = LoggerMessage.Define <Guid>(
                eventId: new EventId(16, "MarkedKeyAsRevokedInTheKeyring"),
                logLevel: LogLevel.Debug,
                formatString: "Marked key {KeyId:B} as revoked in the keyring.");
            _triedToProcessRevocationOfKeyButNoSuchKeyWasFound = LoggerMessage.Define <Guid>(
                eventId: new EventId(17, "TriedToProcessRevocationOfKeyButNoSuchKeyWasFound"),
                logLevel: LogLevel.Warning,
                formatString: "Tried to process revocation of key {KeyId:B}, but no such key was found in keyring. Skipping.");
            _foundKey = LoggerMessage.Define <Guid>(
                eventId: new EventId(18, "FoundKey"),
                logLevel: LogLevel.Debug,
                formatString: "Found key {KeyId:B}.");
            _foundRevocationOfAllKeysCreatedPriorTo = LoggerMessage.Define <DateTimeOffset>(
                eventId: new EventId(19, "FoundRevocationOfAllKeysCreatedPriorTo"),
                logLevel: LogLevel.Debug,
                formatString: "Found revocation of all keys created prior to {RevocationDate:u}.");
            _foundRevocationOfKey = LoggerMessage.Define <Guid>(
                eventId: new EventId(20, "FoundRevocationOfKey"),
                logLevel: LogLevel.Debug,
                formatString: "Found revocation of key {KeyId:B}.");
            _exceptionWhileProcessingRevocationElement = LoggerMessage.Define <XElement>(
                eventId: new EventId(21, "ExceptionWhileProcessingRevocationElement"),
                logLevel: LogLevel.Error,
                formatString: "An exception occurred while processing the revocation element '{RevocationElement}'. Cannot continue keyring processing.");
            _revokingAllKeysAsOfForReason = LoggerMessage.Define <DateTimeOffset, string>(
                eventId: new EventId(22, "RevokingAllKeysAsOfForReason"),
                logLevel: LogLevel.Information,
                formatString: "Revoking all keys as of {RevocationDate:u} for reason '{Reason}'.");
            _keyCacheExpirationTokenTriggeredByOperation = LoggerMessage.Define <string>(
                eventId: new EventId(23, "KeyCacheExpirationTokenTriggeredByOperation"),
                logLevel: LogLevel.Debug,
                formatString: "Key cache expiration token triggered by '{OperationName}' operation.");
            _anExceptionOccurredWhileProcessingTheKeyElement = LoggerMessage.Define <XElement>(
                eventId: new EventId(24, "ExceptionOccurredWhileProcessingTheKeyElement"),
                logLevel: LogLevel.Error,
                formatString: "An exception occurred while processing the key element '{Element}'.");
            _anExceptionOccurredWhileProcessingTheKeyElementDebug = LoggerMessage.Define <XElement>(
                eventId: new EventId(25, "ExceptionOccurredWhileProcessingTheKeyElementDebug"),
                logLevel: LogLevel.Trace,
                formatString: "An exception occurred while processing the key element '{Element}'.");
            _encryptingToWindowsDPAPIForCurrentUserAccount = LoggerMessage.Define <string>(
                eventId: new EventId(26, "EncryptingToWindowsDPAPIForCurrentUserAccount"),
                logLevel: LogLevel.Debug,
                formatString: "Encrypting to Windows DPAPI for current user account ({Name}).");
            _encryptingToWindowsDPAPINGUsingProtectionDescriptorRule = LoggerMessage.Define <string>(
                eventId: new EventId(27, "EncryptingToWindowsDPAPINGUsingProtectionDescriptorRule"),
                logLevel: LogLevel.Debug,
                formatString: "Encrypting to Windows DPAPI-NG using protection descriptor rule '{DescriptorRule}'.");
            _anErrorOccurredWhileEncryptingToX509CertificateWithThumbprint = LoggerMessage.Define <string>(
                eventId: new EventId(28, "ErrorOccurredWhileEncryptingToX509CertificateWithThumbprint"),
                logLevel: LogLevel.Error,
                formatString: "An error occurred while encrypting to X.509 certificate with thumbprint '{Thumbprint}'.");
            _encryptingToX509CertificateWithThumbprint = LoggerMessage.Define <string>(
                eventId: new EventId(29, "EncryptingToX509CertificateWithThumbprint"),
                logLevel: LogLevel.Debug,
                formatString: "Encrypting to X.509 certificate with thumbprint '{Thumbprint}'.");
            _exceptionOccurredWhileTryingToResolveCertificateWithThumbprint = LoggerMessage.Define <string>(
                eventId: new EventId(30, "ExceptionOccurredWhileTryingToResolveCertificateWithThumbprint"),
                logLevel: LogLevel.Error,
                formatString: "An exception occurred while trying to resolve certificate with thumbprint '{Thumbprint}'.");
            _performingProtectOperationToKeyWithPurposes = LoggerMessage.Define <Guid, string>(
                eventId: new EventId(31, "PerformingProtectOperationToKeyWithPurposes"),
                logLevel: LogLevel.Trace,
                formatString: "Performing protect operation to key {KeyId:B} with purposes {Purposes}.");
            _descriptorDeserializerTypeForKeyIs = LoggerMessage.Define <Guid, string>(
                eventId: new EventId(32, "DescriptorDeserializerTypeForKeyIs"),
                logLevel: LogLevel.Debug,
                formatString: "Descriptor deserializer type for key {KeyId:B} is '{AssemblyQualifiedName}'.");
            _keyEscrowSinkFoundWritingKeyToEscrow = LoggerMessage.Define <Guid>(
                eventId: new EventId(33, "KeyEscrowSinkFoundWritingKeyToEscrow"),
                logLevel: LogLevel.Debug,
                formatString: "Key escrow sink found. Writing key {KeyId:B} to escrow.");
            _noKeyEscrowSinkFoundNotWritingKeyToEscrow = LoggerMessage.Define <Guid>(
                eventId: new EventId(34, "NoKeyEscrowSinkFoundNotWritingKeyToEscrow"),
                logLevel: LogLevel.Debug,
                formatString: "No key escrow sink found. Not writing key {KeyId:B} to escrow.");
            _noXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm = LoggerMessage.Define <Guid>(
                eventId: new EventId(35, "NoXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm"),
                logLevel: LogLevel.Warning,
                formatString: "No XML encryptor configured. Key {KeyId:B} may be persisted to storage in unencrypted form.");
            _revokingKeyForReason = LoggerMessage.Define <Guid, DateTimeOffset, string>(
                eventId: new EventId(36, "RevokingKeyForReason"),
                logLevel: LogLevel.Information,
                formatString: "Revoking key {KeyId:B} at {RevocationDate:u} for reason '{Reason}'.");
            _readingDataFromFile = LoggerMessage.Define <string>(
                eventId: new EventId(37, "ReadingDataFromFile"),
                logLevel: LogLevel.Debug,
                formatString: "Reading data from file '{FullPath}'.");
            _nameIsNotSafeFileName = LoggerMessage.Define <string, string>(
                eventId: new EventId(38, "NameIsNotSafeFileName"),
                logLevel: LogLevel.Debug,
                formatString: "The name '{FriendlyName}' is not a safe file name, using '{NewFriendlyName}' instead.");
            _writingDataToFile = LoggerMessage.Define <string>(
                eventId: new EventId(39, "WritingDataToFile"),
                logLevel: LogLevel.Information,
                formatString: "Writing data to file '{FileName}'.");
            _readingDataFromRegistryKeyValue = LoggerMessage.Define <RegistryKey, string>(
                eventId: new EventId(40, "ReadingDataFromRegistryKeyValue"),
                logLevel: LogLevel.Debug,
                formatString: "Reading data from registry key '{RegistryKeyName}', value '{Value}'.");
            _nameIsNotSafeRegistryValueName = LoggerMessage.Define <string, string>(
                eventId: new EventId(41, "NameIsNotSafeRegistryValueName"),
                logLevel: LogLevel.Debug,
                formatString: "The name '{FriendlyName}' is not a safe registry value name, using '{NewFriendlyName}' instead.");
            _decryptingSecretElementUsingWindowsDPAPING = LoggerMessage.Define <string>(
                eventId: new EventId(42, "DecryptingSecretElementUsingWindowsDPAPING"),
                logLevel: LogLevel.Debug,
                formatString: "Decrypting secret element using Windows DPAPI-NG with protection descriptor rule '{DescriptorRule}'.");
            _exceptionOccurredTryingToDecryptElement = LoggerMessage.Define(
                eventId: new EventId(43, "ExceptionOccurredTryingToDecryptElement"),
                logLevel: LogLevel.Error,
                formatString: "An exception occurred while trying to decrypt the element.");
            _encryptingUsingNullEncryptor = LoggerMessage.Define(
                eventId: new EventId(44, "EncryptingUsingNullEncryptor"),
                logLevel: LogLevel.Warning,
                formatString: "Encrypting using a null encryptor; secret information isn't being protected.");
            _usingEphemeralDataProtectionProvider = LoggerMessage.Define(
                eventId: new EventId(45, "UsingEphemeralDataProtectionProvider"),
                logLevel: LogLevel.Warning,
                formatString: "Using ephemeral data protection provider. Payloads will be undecipherable upon application shutdown.");
            _existingCachedKeyRingIsExpiredRefreshing = LoggerMessage.Define(
                eventId: new EventId(46, "ExistingCachedKeyRingIsExpiredRefreshing"),
                logLevel: LogLevel.Debug,
                formatString: "Existing cached key ring is expired. Refreshing.");
            _errorOccurredWhileRefreshingKeyRing = LoggerMessage.Define(
                eventId: new EventId(47, "ErrorOccurredWhileRefreshingKeyRing"),
                logLevel: LogLevel.Error,
                formatString: "An error occurred while refreshing the key ring. Will try again in 2 minutes.");
            _errorOccurredWhileReadingKeyRing = LoggerMessage.Define(
                eventId: new EventId(48, "ErrorOccurredWhileReadingKeyRing"),
                logLevel: LogLevel.Error,
                formatString: "An error occurred while reading the key ring.");
            _keyRingDoesNotContainValidDefaultKey = LoggerMessage.Define(
                eventId: new EventId(49, "KeyRingDoesNotContainValidDefaultKey"),
                logLevel: LogLevel.Error,
                formatString: "The key ring does not contain a valid default key, and the key manager is configured with auto-generation of keys disabled.");
            _usingInmemoryRepository = LoggerMessage.Define(
                eventId: new EventId(50, "UsingInmemoryRepository"),
                logLevel: LogLevel.Warning,
                formatString: "Using an in-memory repository. Keys will not be persisted to storage.");
            _decryptingSecretElementUsingWindowsDPAPI = LoggerMessage.Define(
                eventId: new EventId(51, "DecryptingSecretElementUsingWindowsDPAPI"),
                logLevel: LogLevel.Debug,
                formatString: "Decrypting secret element using Windows DPAPI.");
            _defaultKeyExpirationImminentAndRepository = LoggerMessage.Define(
                eventId: new EventId(52, "DefaultKeyExpirationImminentAndRepository"),
                logLevel: LogLevel.Debug,
                formatString: "Default key expiration imminent and repository contains no viable successor. Caller should generate a successor.");
            _repositoryContainsNoViableDefaultKey = LoggerMessage.Define(
                eventId: new EventId(53, "RepositoryContainsNoViableDefaultKey"),
                logLevel: LogLevel.Debug,
                formatString: "Repository contains no viable default key. Caller should generate a key with immediate activation.");
            _errorOccurredWhileEncryptingToWindowsDPAPI = LoggerMessage.Define(
                eventId: new EventId(54, "ErrorOccurredWhileEncryptingToWindowsDPAPI"),
                logLevel: LogLevel.Error,
                formatString: "An error occurred while encrypting to Windows DPAPI.");
            _encryptingToWindowsDPAPIForLocalMachineAccount = LoggerMessage.Define(
                eventId: new EventId(55, "EncryptingToWindowsDPAPIForLocalMachineAccount"),
                logLevel: LogLevel.Debug,
                formatString: "Encrypting to Windows DPAPI for local machine account.");
            _errorOccurredWhileEncryptingToWindowsDPAPING = LoggerMessage.Define(
                eventId: new EventId(56, "ErrorOccurredWhileEncryptingToWindowsDPAPING"),
                logLevel: LogLevel.Error,
                formatString: "An error occurred while encrypting to Windows DPAPI-NG.");
            _policyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing = LoggerMessage.Define(
                eventId: new EventId(57, "PolicyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing"),
                logLevel: LogLevel.Debug,
                formatString: "Policy resolution states that a new key should be added to the key ring.");
            _creatingKey = LoggerMessage.Define <Guid, DateTimeOffset, DateTimeOffset, DateTimeOffset>(
                eventId: new EventId(58, "CreatingKey"),
                logLevel: LogLevel.Information,
                formatString: "Creating key {KeyId:B} with creation date {CreationDate:u}, activation date {ActivationDate:u}, and expiration date {ExpirationDate:u}.");
            _usingEphemeralKeyRepository = LoggerMessage.Define(
                eventId: new EventId(59, "UsingEphemeralKeyRepository"),
                logLevel: LogLevel.Warning,
                formatString: "Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.");
            _usingEphemeralFileSystemLocationInContainer = LoggerMessage.Define <string>(
                eventId: new EventId(60, "UsingEphemeralFileSystemLocationInContainer"),
                logLevel: LogLevel.Warning,
                formatString: Resources.FileSystem_EphemeralKeysLocationInContainer);

            _usingRegistryAsKeyRepositoryWithDPAPI = LoggerMessage.Define <string>(
                eventId: new EventId(0, "UsingRegistryAsKeyRepositoryWithDPAPI"),
                logLevel: LogLevel.Information,
                formatString: "User profile not available. Using '{Name}' as key repository and Windows DPAPI to encrypt keys at rest.");
            _usingProfileAsKeyRepository = LoggerMessage.Define <string>(
                eventId: new EventId(0, "UsingProfileAsKeyRepository"),
                logLevel: LogLevel.Information,
                formatString: "User profile is available. Using '{FullName}' as key repository; keys will not be encrypted at rest.");
            _usingProfileAsKeyRepositoryWithDPAPI = LoggerMessage.Define <string>(
                eventId: new EventId(0, "UsingProfileAsKeyRepositoryWithDPAPI"),
                logLevel: LogLevel.Information,
                formatString: "User profile is available. Using '{FullName}' as key repository and Windows DPAPI to encrypt keys at rest.");
            _usingAzureAsKeyRepository = LoggerMessage.Define <string>(
                eventId: new EventId(0, "UsingAzureAsKeyRepository"),
                logLevel: LogLevel.Information,
                formatString: "Azure Web Sites environment detected. Using '{FullName}' as key repository; keys will not be encrypted at rest.");
            _keyRingWasLoadedOnStartup = LoggerMessage.Define <Guid>(
                eventId: new EventId(0, "KeyRingWasLoadedOnStartup"),
                logLevel: LogLevel.Debug,
                formatString: "Key ring with default key {KeyId:B} was loaded during application startup.");
            _keyRingFailedToLoadOnStartup = LoggerMessage.Define(
                eventId: new EventId(0, "KeyRingFailedToLoadOnStartup"),
                logLevel: LogLevel.Information,
                formatString: "Key ring failed to load during application startup.");
        }
Example #2
0
 static LoggerExtensions()
 {
     _informationRequested = LoggerMessage.Define <string>(LogLevel.Information, new EventId(1, nameof(Information)), "{LogContent}");
 }
        static LoggingExtensions()
        {
            // Final
            _redirectToIdentityProviderForSignOutHandledResponse = LoggerMessage.Define(
                eventId: new EventId(1, "RedirectToIdentityProviderForSignOutHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "RedirectToIdentityProviderForSignOut.HandledResponse");
            _invalidLogoutQueryStringRedirectUrl = LoggerMessage.Define <string>(
                eventId: new EventId(3, "InvalidLogoutQueryStringRedirectUrl"),
                logLevel: LogLevel.Warning,
                formatString: "The query string for Logout is not a well-formed URI. Redirect URI: '{RedirectUrl}'.");
            _enteringOpenIdAuthenticationHandlerHandleUnauthorizedAsync = LoggerMessage.Define <string>(
                eventId: new EventId(4, "EnteringOpenIdAuthenticationHandlerHandleUnauthorizedAsync"),
                logLevel: LogLevel.Trace,
                formatString: "Entering {OpenIdConnectHandlerType}'s HandleUnauthorizedAsync.");
            _enteringOpenIdAuthenticationHandlerHandleSignOutAsync = LoggerMessage.Define <string>(
                eventId: new EventId(14, "EnteringOpenIdAuthenticationHandlerHandleSignOutAsync"),
                logLevel: LogLevel.Trace,
                formatString: "Entering {OpenIdConnectHandlerType}'s HandleSignOutAsync.");
            _postAuthenticationLocalRedirect = LoggerMessage.Define <string>(
                eventId: new EventId(5, "PostAuthenticationLocalRedirect"),
                logLevel: LogLevel.Trace,
                formatString: "Using properties.RedirectUri for 'local redirect' post authentication: '{RedirectUri}'.");
            _redirectToIdentityProviderHandledResponse = LoggerMessage.Define(
                eventId: new EventId(6, "RedirectToIdentityProviderHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "RedirectToIdentityProvider.HandledResponse");
            _invalidAuthenticationRequestUrl = LoggerMessage.Define <string>(
                eventId: new EventId(8, "InvalidAuthenticationRequestUrl"),
                logLevel: LogLevel.Warning,
                formatString: "The redirect URI is not well-formed. The URI is: '{AuthenticationRequestUrl}'.");
            _enteringOpenIdAuthenticationHandlerHandleRemoteAuthenticateAsync = LoggerMessage.Define <string>(
                eventId: new EventId(9, "EnteringOpenIdAuthenticationHandlerHandleRemoteAuthenticateAsync"),
                logLevel: LogLevel.Trace,
                formatString: "Entering {OpenIdConnectHandlerType}'s HandleRemoteAuthenticateAsync.");
            _nullOrEmptyAuthorizationResponseState = LoggerMessage.Define(
                eventId: new EventId(10, "NullOrEmptyAuthorizationResponseState"),
                logLevel: LogLevel.Debug,
                formatString: "message.State is null or empty.");
            _unableToReadAuthorizationResponseState = LoggerMessage.Define(
                eventId: new EventId(11, "UnableToReadAuthorizationResponseState"),
                logLevel: LogLevel.Debug,
                formatString: "Unable to read the message.State.");
            _responseError = LoggerMessage.Define <string, string, string>(
                eventId: new EventId(12, "ResponseError"),
                logLevel: LogLevel.Error,
                formatString: "Message contains error: '{Error}', error_description: '{ErrorDescription}', error_uri: '{ErrorUri}'.");
            _responseErrorWithStatusCode = LoggerMessage.Define <string, string, string, int>(
                eventId: new EventId(52, "ResponseErrorWithStatusCode"),
                logLevel: LogLevel.Error,
                formatString: "Message contains error: '{Error}', error_description: '{ErrorDescription}', error_uri: '{ErrorUri}', status code '{StatusCode}'.");
            _updatingConfiguration = LoggerMessage.Define(
                eventId: new EventId(13, "UpdatingConfiguration"),
                logLevel: LogLevel.Debug,
                formatString: "Updating configuration");
            _tokenValidatedHandledResponse = LoggerMessage.Define(
                eventId: new EventId(15, "TokenValidatedHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "TokenValidated.HandledResponse");
            _tokenValidatedSkipped = LoggerMessage.Define(
                eventId: new EventId(16, "TokenValidatedSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "TokenValidated.Skipped");
            _exceptionProcessingMessage = LoggerMessage.Define(
                eventId: new EventId(17, "ExceptionProcessingMessage"),
                logLevel: LogLevel.Error,
                formatString: "Exception occurred while processing message.");
            _configurationManagerRequestRefreshCalled = LoggerMessage.Define(
                eventId: new EventId(18, "ConfigurationManagerRequestRefreshCalled"),
                logLevel: LogLevel.Debug,
                formatString: "Exception of type 'SecurityTokenSignatureKeyNotFoundException' thrown, Options.ConfigurationManager.RequestRefresh() called.");
            _redeemingCodeForTokens = LoggerMessage.Define(
                eventId: new EventId(19, "RedeemingCodeForTokens"),
                logLevel: LogLevel.Debug,
                formatString: "Redeeming code for tokens.");
            _retrievingClaims = LoggerMessage.Define(
                eventId: new EventId(20, "RetrievingClaims"),
                logLevel: LogLevel.Trace,
                formatString: "Retrieving claims from the user info endpoint.");
            _receivedIdToken = LoggerMessage.Define(
                eventId: new EventId(21, "ReceivedIdToken"),
                logLevel: LogLevel.Debug,
                formatString: "Received 'id_token'");
            _userInfoEndpointNotSet = LoggerMessage.Define(
                eventId: new EventId(22, "UserInfoEndpointNotSet"),
                logLevel: LogLevel.Debug,
                formatString: "UserInfoEndpoint is not set. Claims cannot be retrieved.");
            _unableToProtectNonceCookie = LoggerMessage.Define(
                eventId: new EventId(23, "UnableToProtectNonceCookie"),
                logLevel: LogLevel.Warning,
                formatString: "Failed to un-protect the nonce cookie.");
            _messageReceived = LoggerMessage.Define <string>(
                eventId: new EventId(24, "MessageReceived"),
                logLevel: LogLevel.Trace,
                formatString: "MessageReceived: '{RedirectUrl}'.");
            _messageReceivedContextHandledResponse = LoggerMessage.Define(
                eventId: new EventId(25, "MessageReceivedContextHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "MessageReceivedContext.HandledResponse");
            _messageReceivedContextSkipped = LoggerMessage.Define(
                eventId: new EventId(26, "MessageReceivedContextSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "MessageReceivedContext.Skipped");
            _authorizationCodeReceived = LoggerMessage.Define(
                eventId: new EventId(27, "AuthorizationCodeReceived"),
                logLevel: LogLevel.Trace,
                formatString: "Authorization code received.");
            _authorizationCodeReceivedContextHandledResponse = LoggerMessage.Define(
                eventId: new EventId(28, "AuthorizationCodeReceivedContextHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "AuthorizationCodeReceivedContext.HandledResponse");
            _authorizationCodeReceivedContextSkipped = LoggerMessage.Define(
                eventId: new EventId(29, "AuthorizationCodeReceivedContextSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "AuthorizationCodeReceivedContext.Skipped");
            _tokenResponseReceived = LoggerMessage.Define(
                eventId: new EventId(30, "TokenResponseReceived"),
                logLevel: LogLevel.Trace,
                formatString: "Token response received.");
            _tokenResponseReceivedHandledResponse = LoggerMessage.Define(
                eventId: new EventId(31, "TokenResponseReceivedHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "TokenResponseReceived.HandledResponse");
            _tokenResponseReceivedSkipped = LoggerMessage.Define(
                eventId: new EventId(32, "TokenResponseReceivedSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "TokenResponseReceived.Skipped");
            _postSignOutRedirect = LoggerMessage.Define <string>(
                eventId: new EventId(33, "PostSignOutRedirect"),
                logLevel: LogLevel.Trace,
                formatString: "Using properties.RedirectUri for redirect post authentication: '{RedirectUri}'.");
            _userInformationReceived = LoggerMessage.Define <string>(
                eventId: new EventId(35, "UserInformationReceived"),
                logLevel: LogLevel.Trace,
                formatString: "User information received: {User}");
            _userInformationReceivedHandledResponse = LoggerMessage.Define(
                eventId: new EventId(36, "UserInformationReceivedHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "The UserInformationReceived event returned Handled.");
            _userInformationReceivedSkipped = LoggerMessage.Define(
                eventId: new EventId(37, "UserInformationReceivedSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "The UserInformationReceived event returned Skipped.");
            _authenticationFailedContextHandledResponse = LoggerMessage.Define(
                eventId: new EventId(38, "AuthenticationFailedContextHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "AuthenticationFailedContext.HandledResponse");
            _authenticationFailedContextSkipped = LoggerMessage.Define(
                eventId: new EventId(39, "AuthenticationFailedContextSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "AuthenticationFailedContext.Skipped");
            _invalidSecurityTokenType = LoggerMessage.Define <string>(
                eventId: new EventId(40, "InvalidSecurityTokenType"),
                logLevel: LogLevel.Error,
                formatString: "The Validated Security Token must be of type JwtSecurityToken, but instead its type is: '{SecurityTokenType}'");
            _unableToValidateIdToken = LoggerMessage.Define <string>(
                eventId: new EventId(41, "UnableToValidateIdToken"),
                logLevel: LogLevel.Error,
                formatString: "Unable to validate the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'.");
            _accessTokenNotAvailable = LoggerMessage.Define(
                eventId: new EventId(42, "AccessTokenNotAvailable"),
                logLevel: LogLevel.Debug,
                formatString: "The access_token is not available. Claims cannot be retrieved.");
            _unableToReadIdToken = LoggerMessage.Define <string>(
                eventId: new EventId(43, "UnableToReadIdToken"),
                logLevel: LogLevel.Error,
                formatString: "Unable to read the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'.");
            _remoteSignOutHandledResponse = LoggerMessage.Define(
                eventId: new EventId(44, "RemoteSignOutHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "RemoteSignOutContext.HandledResponse");
            _remoteSignOutSkipped = LoggerMessage.Define(
                eventId: new EventId(45, "RemoteSignOutSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "RemoteSignOutContext.Skipped");
            _remoteSignOut = LoggerMessage.Define(
                eventId: new EventId(46, "RemoteSignOut"),
                logLevel: LogLevel.Information,
                formatString: "Remote signout request processed.");
            _remoteSignOutSessionIdMissing = LoggerMessage.Define(
                eventId: new EventId(47, "RemoteSignOutSessionIdMissing"),
                logLevel: LogLevel.Error,
                formatString: "The remote signout request was ignored because the 'sid' parameter " +
                "was missing, which may indicate an unsolicited logout.");
            _remoteSignOutSessionIdInvalid = LoggerMessage.Define(
                eventId: new EventId(48, "RemoteSignOutSessionIdInvalid"),
                logLevel: LogLevel.Error,
                formatString: "The remote signout request was ignored because the 'sid' parameter didn't match " +
                "the expected value, which may indicate an unsolicited logout.");
            _authenticationSchemeSignedOut = LoggerMessage.Define <string>(
                eventId: new EventId(49, "AuthenticationSchemeSignedOut"),
                logLevel: LogLevel.Information,
                formatString: "AuthenticationScheme: {AuthenticationScheme} signed out.");
            _signOutCallbackRedirectHandledResponse = LoggerMessage.Define(
                eventId: new EventId(50, "SignOutCallbackRedirectHandledResponse"),
                logLevel: LogLevel.Debug,
                formatString: "RedirectToSignedOutRedirectUri.HandledResponse");
            _signOutCallbackRedirectSkipped = LoggerMessage.Define(
                eventId: new EventId(51, "SignOutCallbackRedirectSkipped"),
                logLevel: LogLevel.Debug,
                formatString: "RedirectToSignedOutRedirectUri.Skipped");

            //  EventId 52 is used by ResponseErrorWithStatusCode
            _handleChallenge = LoggerMessage.Define <string, string>(
                eventId: new EventId(53, "HandleChallenge"),
                logLevel: LogLevel.Debug,
                formatString: "HandleChallenge with Location: {Location}; and Set-Cookie: {Cookie}.");
        }
 static LoggingExtensions()
 {
     // Final
     _redirectToIdentityProviderForSignOutHandledResponse = LoggerMessage.Define(
         eventId: 1,
         logLevel: LogLevel.Debug,
         formatString: "RedirectToIdentityProviderForSignOut.HandledResponse");
     _redirectToIdentityProviderForSignOutSkipped = LoggerMessage.Define(
         eventId: 2,
         logLevel: LogLevel.Debug,
         formatString: "RedirectToIdentityProviderForSignOut.Skipped");
     _invalidLogoutQueryStringRedirectUrl = LoggerMessage.Define <string>(
         eventId: 3,
         logLevel: LogLevel.Warning,
         formatString: "The query string for Logout is not a well-formed URI. Redirect URI: '{RedirectUrl}'.");
     _enteringOpenIdAuthenticationHandlerHandleUnauthorizedAsync = LoggerMessage.Define <string>(
         eventId: 4,
         logLevel: LogLevel.Trace,
         formatString: "Entering {OpenIdConnectHandlerType}'s HandleUnauthorizedAsync.");
     _postAuthenticationLocalRedirect = LoggerMessage.Define <string>(
         eventId: 5,
         logLevel: LogLevel.Trace,
         formatString: "Using properties.RedirectUri for 'local redirect' post authentication: '{RedirectUri}'.");
     _redirectToIdentityProviderHandledResponse = LoggerMessage.Define(
         eventId: 6,
         logLevel: LogLevel.Debug,
         formatString: "RedirectToIdentityProvider.HandledResponse");
     _redirectToIdentityProviderSkipped = LoggerMessage.Define(
         eventId: 7,
         logLevel: LogLevel.Debug,
         formatString: "RedirectToIdentityProvider.Skipped");
     _invalidAuthenticationRequestUrl = LoggerMessage.Define <string>(
         eventId: 8,
         logLevel: LogLevel.Warning,
         formatString: "The redirect URI is not well-formed. The URI is: '{AuthenticationRequestUrl}'.");
     _enteringOpenIdAuthenticationHandlerHandleRemoteAuthenticateAsync = LoggerMessage.Define <string>(
         eventId: 9,
         logLevel: LogLevel.Trace,
         formatString: "Entering {OpenIdConnectHandlerType}'s HandleRemoteAuthenticateAsync.");
     _nullOrEmptyAuthorizationResponseState = LoggerMessage.Define(
         eventId: 10,
         logLevel: LogLevel.Debug,
         formatString: "message.State is null or empty.");
     _unableToReadAuthorizationResponseState = LoggerMessage.Define(
         eventId: 11,
         logLevel: LogLevel.Debug,
         formatString: "Unable to read the message.State.");
     _authorizationResponseError = LoggerMessage.Define <string, string, string>(
         eventId: 12,
         logLevel: LogLevel.Error,
         formatString: "Message contains error: '{Error}', error_description: '{ErrorDescription}', error_uri: '{ErrorUri}'.");
     _updatingConfiguration = LoggerMessage.Define(
         eventId: 13,
         logLevel: LogLevel.Debug,
         formatString: "Updating configuration");
     _tokenValidatedHandledResponse = LoggerMessage.Define(
         eventId: 15,
         logLevel: LogLevel.Debug,
         formatString: "TokenValidated.HandledResponse");
     _tokenValidatedSkipped = LoggerMessage.Define(
         eventId: 16,
         logLevel: LogLevel.Debug,
         formatString: "TokenValidated.Skipped");
     _exceptionProcessingMessage = LoggerMessage.Define(
         eventId: 17,
         logLevel: LogLevel.Error,
         formatString: "Exception occurred while processing message.");
     _configurationManagerRequestRefreshCalled = LoggerMessage.Define(
         eventId: 18,
         logLevel: LogLevel.Debug,
         formatString: "Exception of type 'SecurityTokenSignatureKeyNotFoundException' thrown, Options.ConfigurationManager.RequestRefresh() called.");
     _redeemingCodeForTokens = LoggerMessage.Define(
         eventId: 19,
         logLevel: LogLevel.Debug,
         formatString: "Redeeming code for tokens.");
     _retrievingClaims = LoggerMessage.Define(
         eventId: 20,
         logLevel: LogLevel.Trace,
         formatString: "Retrieving claims from the user info endpoint.");
     _receivedIdToken = LoggerMessage.Define(
         eventId: 21,
         logLevel: LogLevel.Debug,
         formatString: "Received 'id_token'");
     _userInfoEndpointNotSet = LoggerMessage.Define(
         eventId: 22,
         logLevel: LogLevel.Debug,
         formatString: "UserInfoEndpoint is not set. Claims cannot be retrieved.");
     _unableToProtectNonceCookie = LoggerMessage.Define(
         eventId: 23,
         logLevel: LogLevel.Warning,
         formatString: "Failed to un-protect the nonce cookie.");
     _messageReceived = LoggerMessage.Define <string>(
         eventId: 24,
         logLevel: LogLevel.Trace,
         formatString: "MessageReceived: '{RedirectUrl}'.");
     _messageReceivedContextHandledResponse = LoggerMessage.Define(
         eventId: 25,
         logLevel: LogLevel.Debug,
         formatString: "MessageReceivedContext.HandledResponse");
     _messageReceivedContextSkipped = LoggerMessage.Define(
         eventId: 26,
         logLevel: LogLevel.Debug,
         formatString: "MessageReceivedContext.Skipped");
     _authorizationCodeReceived = LoggerMessage.Define(
         eventId: 27,
         logLevel: LogLevel.Trace,
         formatString: "Authorization code received.");
     _authorizationCodeReceivedContextHandledResponse = LoggerMessage.Define(
         eventId: 28,
         logLevel: LogLevel.Debug,
         formatString: "AuthorizationCodeReceivedContext.HandledResponse");
     _authorizationCodeReceivedContextSkipped = LoggerMessage.Define(
         eventId: 29,
         logLevel: LogLevel.Debug,
         formatString: "AuthorizationCodeReceivedContext.Skipped");
     _tokenResponseReceived = LoggerMessage.Define(
         eventId: 30,
         logLevel: LogLevel.Trace,
         formatString: "Token response received.");
     _tokenResponseReceivedHandledResponse = LoggerMessage.Define(
         eventId: 31,
         logLevel: LogLevel.Debug,
         formatString: "TokenResponseReceived.HandledResponse");
     _tokenResponseReceivedSkipped = LoggerMessage.Define(
         eventId: 32,
         logLevel: LogLevel.Debug,
         formatString: "TokenResponseReceived.Skipped");
     _userInformationReceived = LoggerMessage.Define <string>(
         eventId: 35,
         logLevel: LogLevel.Trace,
         formatString: "User information received: {User}");
     _userInformationReceivedHandledResponse = LoggerMessage.Define(
         eventId: 36,
         logLevel: LogLevel.Debug,
         formatString: "The UserInformationReceived event returned Handled.");
     _userInformationReceivedSkipped = LoggerMessage.Define(
         eventId: 37,
         logLevel: LogLevel.Debug,
         formatString: "The UserInformationReceived event returned Skipped.");
     _authenticationFailedContextHandledResponse = LoggerMessage.Define(
         eventId: 38,
         logLevel: LogLevel.Debug,
         formatString: "AuthenticationFailedContext.HandledResponse");
     _authenticationFailedContextSkipped = LoggerMessage.Define(
         eventId: 39,
         logLevel: LogLevel.Debug,
         formatString: "AuthenticationFailedContext.Skipped");
     _invalidSecurityTokenType = LoggerMessage.Define <string>(
         eventId: 40,
         logLevel: LogLevel.Error,
         formatString: "The Validated Security Token must be of type JwtSecurityToken, but instead its type is: '{SecurityTokenType}'");
     _unableToValidateIdToken = LoggerMessage.Define <string>(
         eventId: 41,
         logLevel: LogLevel.Error,
         formatString: "Unable to validate the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'.");
     _accessTokenNotAvailable = LoggerMessage.Define(
         eventId: 42,
         logLevel: LogLevel.Debug,
         formatString: "The access_token is not available. Claims cannot be retrieved.");
     _unableToReadIdToken = LoggerMessage.Define <string>(
         eventId: 43,
         logLevel: LogLevel.Error,
         formatString: "Unable to read the 'id_token', no suitable ISecurityTokenValidator was found for: '{IdToken}'.");
 }
Example #5
0
 static ScopeInfoWithThreeParameters()
 {
     ScopeDelegate = LoggerMessage.DefineScope <string, string, int>(NamedStringFormat);
 }
Example #6
0
 static ScopeWithOneParameter()
 {
     ScopeDelegate = LoggerMessage.DefineScope <string>(NamedStringFormat);
 }
Example #7
0
 static ScopeWithoutAnyParameters()
 {
     ScopeDelegate = LoggerMessage.DefineScope(Message);
 }