-
Notifications
You must be signed in to change notification settings - Fork 241
Fixes #2251 #2252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fixes #2251 #2252
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4e44fdd
Fixes ##2251
jmprieur 67aaa7f
Adding unit tests for:
jmprieur 385766d
Update codeql-analysis.yml
jmprieur f8a99c0
Addressing PR feedback
jmprieur b8513c2
Merge branch 'jmprieur/fixSignedAssertions' of https://github.com/Azu…
jmprieur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -44,12 +44,7 @@ jobs: | |
| # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
| # and modify them (or add more) to build your code if your project | ||
| # uses a compiled language | ||
|
|
||
| - name: Setup .NET 6.0.301 | ||
| uses: actions/[email protected] | ||
| with: | ||
| dotnet-version: 6.0.301 | ||
|
|
||
|
|
||
| - name: Setup .NET 7.0.x | ||
| uses: actions/[email protected] | ||
| with: | ||
|
|
@@ -59,9 +54,6 @@ jobs: | |
| - name: Setup wasm-tools | ||
| run: dotnet workload install wasm-tools | ||
|
|
||
| - name: Build with .NET 6 | ||
| run: dotnet test Microsoft.Identity.Web.sln -f net6.0 -p:FROM_GITHUB_ACTION=true --configuration Release --filter "(FullyQualifiedName!~Microsoft.Identity.Web.Test.Integration)&(FullyQualifiedName!~WebAppUiTests)&(FullyQualifiedName!~IntegrationTests)" | ||
|
|
||
| - name: Build with .NET 7 | ||
| run: dotnet test Microsoft.Identity.Web.sln -f net7.0 -p:FROM_GITHUB_ACTION=true --configuration Release --filter "(FullyQualifiedName!~Microsoft.Identity.Web.Test.Integration)&(FullyQualifiedName!~WebAppUiTests)&(FullyQualifiedName=IntegrationTests)" | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
105 changes: 105 additions & 0 deletions
105
...icrosoft.Identity.Web.Certificateless/AzureIdentityForKubernetesClientAssertion.Logger.cs
This file contains hidden or 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,105 @@ | ||
| // 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 Logger | ||
| { | ||
| public static void SignedAssertionFileDiskPathNotProvided(ILogger? logger) | ||
| { | ||
| if (logger != null && logger.IsEnabled(LogLevel.Information)) | ||
| { | ||
| __SignedAssertionFileDiskPathNotProvidedCallback(logger, null); | ||
| } | ||
| } | ||
|
|
||
| public static void SignedAssertionEnvironmentVariableNotProvided(ILogger? logger, string environmentVariableName) | ||
| { | ||
| if (logger != null && logger.IsEnabled(LogLevel.Information)) | ||
| { | ||
| __SignedAssertionEnvironmentVariableNotProvidedCallback(logger, environmentVariableName, null); | ||
| } | ||
| } | ||
|
|
||
| public static void NoSignedAssertionParameterProvided(ILogger? logger) | ||
| { | ||
| if (logger != null && logger.IsEnabled(LogLevel.Error)) | ||
| { | ||
| __NoSignedAssertionParameterProvidedCallback(logger, null); | ||
| } | ||
| } | ||
|
|
||
| public static void FileAssertionPathNotFound(ILogger? logger, string filePath) | ||
| { | ||
| if (logger != null && logger.IsEnabled(LogLevel.Error)) | ||
| { | ||
| __FileAssertionPathNotFoundCallback(logger, filePath, null); | ||
| } | ||
| } | ||
|
|
||
| public static void SuccessFullyReadSignedAssertion(ILogger? logger, string filePath, DateTime expiry) | ||
| { | ||
| if (logger != null && logger.IsEnabled(LogLevel.Information)) | ||
| { | ||
| __SuccessFullyReadSignedAssertionCallback(logger, filePath, expiry, null); | ||
| } | ||
| } | ||
|
|
||
| public static void FileDoesNotContainValidAssertion(ILogger? logger, string filePath, string message) | ||
| { | ||
| if (logger != null && logger.IsEnabled(LogLevel.Error)) | ||
| { | ||
| __FileDoesNotContainValidAssertionCallback(logger, filePath, message, null); | ||
| } | ||
| } | ||
|
|
||
| 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. "); | ||
| private static readonly Action<ILogger, string, Exception?> __SignedAssertionEnvironmentVariableNotProvidedCallback = | ||
| LoggerMessage.Define<string>(LogLevel.Information, new EventId(2, nameof(SignedAssertionEnvironmentVariableNotProvided)), "The `{environmentVariableName}` environment variable not provided. "); | ||
|
|
||
| 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. "); | ||
|
|
||
| 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. "); | ||
|
|
||
| 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}. "); | ||
|
|
||
| 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}. "); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.