-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and the same issue for WIF for MSI and adds loggin in WIF for AKS
- Loading branch information
Showing
9 changed files
with
237 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/Microsoft.Identity.Web.Certificateless/AzureIdentityForKubernetesClientAssertion.Log.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Microsoft.Identity.Web | ||
{ | ||
public partial class AzureIdentityForKubernetesClientAssertion | ||
{ | ||
/* | ||
// High performance logger messages (before generation). | ||
#pragma warning disable SYSLIB1009 // Logging methods must be static | ||
[LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = "SignedAssertionFileDiskPath not provided. Falling back to the content of the AZURE_FEDERATED_TOKEN_FILE environment variable.")] | ||
partial void SignedAssertionFileDiskPathNotProvided(ILogger logger); | ||
[LoggerMessage(EventId = 2, Level = LogLevel.Information, Message = "The `{environmentVariableName}` environment variable not provided.")] | ||
partial void SignedAssertionEnvironmentVariableNotProvided(ILogger logger, string environmentVariableName); | ||
[LoggerMessage(EventId = 3, Level = LogLevel.Error, Message = "The environment variable AZURE_FEDERATED_TOKEN_FILE or AZURE_ACCESS_TOKEN_FILE or the 'SignedAssertionFileDiskPath' must be set to the path of the file containing the signed assertion.")] | ||
partial void NoSignedAssertionParameterProvided(ILogger logger); | ||
[LoggerMessage(EventId = 4, Level = LogLevel.Error, Message = "The file `{filePath}` containing the signed assertion was not found.")] | ||
partial void FileAssertionPathNotFound(ILogger logger, string filePath); | ||
[LoggerMessage(EventId = 5, Level = LogLevel.Information, Message = "Successfully read the signed assertion for `{filePath}`. Expires at {expiry}.")] | ||
partial void SuccessFullyReadSignedAssertion(ILogger logger, string filePath, DateTime expiry); | ||
[LoggerMessage(EventId = 6, Level = LogLevel.Error, Message = "The file `{filePath} does not contain a valid signed assertion. {message}.")] | ||
partial void FileDoesNotContainValidAssertion(ILogger logger, string filePath, string message); | ||
#pragma warning restore SYSLIB1009 // Logging methods must be static | ||
*/ | ||
|
||
/// <summary> | ||
/// Performant logging messages. | ||
/// </summary> | ||
static class Log | ||
{ | ||
private static readonly Action<ILogger, Exception?> __SignedAssertionFileDiskPathNotProvidedCallback = | ||
LoggerMessage.Define(LogLevel.Information, new EventId(1, nameof(SignedAssertionFileDiskPathNotProvided)), "SignedAssertionFileDiskPath not provided. Falling back to the content of the AZURE_FEDERATED_TOKEN_FILE environment variable."); | ||
|
||
public static void SignedAssertionFileDiskPathNotProvided(ILogger? logger) | ||
{ | ||
if (logger != null && logger.IsEnabled(LogLevel.Information)) | ||
{ | ||
__SignedAssertionFileDiskPathNotProvidedCallback(logger, null); | ||
} | ||
} | ||
private static readonly Action<ILogger, string, Exception?> __SignedAssertionEnvironmentVariableNotProvidedCallback = | ||
LoggerMessage.Define<string>(LogLevel.Information, new EventId(2, nameof(SignedAssertionEnvironmentVariableNotProvided)), "The `{environmentVariableName}` environment variable not provided."); | ||
|
||
public static void SignedAssertionEnvironmentVariableNotProvided(ILogger? logger, string environmentVariableName) | ||
{ | ||
if (logger != null && logger.IsEnabled(LogLevel.Information)) | ||
{ | ||
__SignedAssertionEnvironmentVariableNotProvidedCallback(logger, environmentVariableName, null); | ||
} | ||
} | ||
private static readonly Action<ILogger, Exception?> __NoSignedAssertionParameterProvidedCallback = | ||
LoggerMessage.Define(LogLevel.Error, new EventId(3, nameof(NoSignedAssertionParameterProvided)), "The environment variable AZURE_FEDERATED_TOKEN_FILE or AZURE_ACCESS_TOKEN_FILE or the 'SignedAssertionFileDiskPath' must be set to the path of the file containing the signed assertion."); | ||
|
||
public static void NoSignedAssertionParameterProvided(ILogger? logger) | ||
{ | ||
if (logger != null && logger.IsEnabled(LogLevel.Error)) | ||
{ | ||
__NoSignedAssertionParameterProvidedCallback(logger, null); | ||
} | ||
} | ||
private static readonly Action<ILogger, string, Exception?> __FileAssertionPathNotFoundCallback = | ||
LoggerMessage.Define<string>(LogLevel.Error, new EventId(4, nameof(FileAssertionPathNotFound)), "The file `{filePath}` containing the signed assertion was not found."); | ||
|
||
public static void FileAssertionPathNotFound(ILogger? logger, string filePath) | ||
{ | ||
if (logger != null && logger.IsEnabled(LogLevel.Error)) | ||
{ | ||
__FileAssertionPathNotFoundCallback(logger, filePath, null); | ||
} | ||
} | ||
private static readonly Action<ILogger, string, DateTime, Exception?> __SuccessFullyReadSignedAssertionCallback = | ||
LoggerMessage.Define<string, DateTime>(LogLevel.Information, new EventId(5, nameof(SuccessFullyReadSignedAssertion)), "Successfully read the signed assertion for `{filePath}`. Expires at {expiry}."); | ||
|
||
public static void SuccessFullyReadSignedAssertion(ILogger? logger, string filePath, DateTime expiry) | ||
{ | ||
if (logger != null && logger.IsEnabled(LogLevel.Information)) | ||
{ | ||
__SuccessFullyReadSignedAssertionCallback(logger, filePath, expiry, null); | ||
} | ||
} | ||
private static readonly Action<ILogger, string, string, Exception?> __FileDoesNotContainValidAssertionCallback = | ||
LoggerMessage.Define<string, string>(LogLevel.Error, new EventId(6, nameof(FileDoesNotContainValidAssertion)), "The file `{filePath} does not contain a valid signed assertion. {message}."); | ||
|
||
public static void FileDoesNotContainValidAssertion(ILogger? logger, string filePath, string message) | ||
{ | ||
if (logger != null && logger.IsEnabled(LogLevel.Error)) | ||
{ | ||
__FileDoesNotContainValidAssertionCallback(logger, filePath, message, null); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.