-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
author Roja Ennam <roennam@microsoft.com> 1650579606 -0700 committer brentschmaltz <brentschmaltz@hotmail.com> 1652933215 -0700 Creating EcdhKeyExchangeProvider Adding target for net core 3.1 This reverts commit 5c51220. Adding immediate retry on network failure + better logging during configuation retrieval (#1784) * Adding immediate retry on network failure to the token validation flow using ConfigurationManager (specifically inside of HttpDocumentRetriever) * Adding better logging during configuration retrieval Adding more information on key location to error messages (#1786) rename JwtHandler -> JsonWebTokenHandler adjust tests to throw invalid signature Simplify the EventBasedLRUCache and Allows Skipping LRU (#1783) * simplify the EventBasedLRUCache bit and added the _maintainLRU flag to skip the maintenance of LRU * resolved review comments * 1. let the event queue task continue to run for 2 min after the queue is empty 2. stop the task when the InMemoryCryptoProviderCache.Dispose() is called * skip all operations on _doubleLinkedList when _maintainLRU = false * fixed the failed test MaintainLRUOrder (_maintainLRU needs to set to true) Update DisposableObjectPool to dispose on Free() when full When the internal `items` array of DisposableObjectPool is full, calls to Free() (that are trying to return over-allocated instances during a spike in calls to Allocate() "drop" the object by doing nothing. Since the object is not disposed, before it can be garbage collected it has to wait in the finalization queue for finalization to call dispose. This change updates Free() to directly dispose those objects which can't be returned to the pool, allowing them to avoid a potentially long wait in the finalizer queue. param check for null fix check for tenantId (#1801) update version to 6.15.2 Adding LKG feature into JwtSecurityTokenHandler Adding tests for SignatureValidatorUsingConfiguration address comment add IsRecoverableConfiguration mark metadata address as non-PII Make M.IM.Tokens visible to S2S.Tokens (#1807) added the ValidateTokenAsyc() and ReadToken() methods to all token handlers (#1810) * added the ValidateTokenAsyc() method to all token handlers * implement the ValidateTokenAsync() for JwtSecurityTokenHandler * added the TokenHandler.ReadToken() method * return async result via .ConfigureAwait(false).GetAwaiter().GetResult(), and don't catch general Exception * added expected exceptions to the TokenHandler.cs() and removed CA1031 from GlobalSuppression as we are now caching specific exceptions * added more comments * updated all token handlers to catch the general exception (like in JsonWebTokenHandler) to be consistent * updated comments * always return the first ClaimsIdentity from the ClaimsPrincipal as TokenValidationResult.ClaimsIdentity * return the first identity from the ClaimsPrincipal in Saml2SecurityTokenHandler.ValidateTokenAsync() so it is consistent with Saml1 update version to 6.16.1 (#1811) update patch version after release of 6.16.0 Configuration validator (#1825) Introduce an ConfigurationValidator class that can be used to apply validation rules to a retrieved configuration. Simplify strings comparison with Ordinal option update version update version for next release Add 'cty' claim to JWE header Address comments Fix tests (#1838) Fix DEF test (#1839) Copying work from broken topic branch EcdsaKeyWrap Provider Constants Ecdh test Creating EcdhKeyExchangeProvider Removed unnecesary code and comments from ReferenceTests Created Ecdh Security Key Removing EcdhSecurityKey since ECDsaSecurityKey is the same thing Modifying ctor for EcdhKeyExchangeProvider Refactoring + overloads for ctrs in KeyExchangeProvider Differentiate in between ECDH-ES and ECDH-ES+A{128|192|256}KW. Setting AlgorithmID accordingly to alg and enc values. Returning CEK as SecurityKey Changes to Reference test to reflect the changes enc is not optional for key exchange provider apu and apv can be null/empty for generate cek added comments to guide ECDH-ES Adding Jwt header params for epk, apu and apv Adding supported algorithms for symmetric keywrap Adding ECDH-ES logic/cases to JsonWebTokenHandler added test for creating a JWE Test cases for Jwe using Ecdh-ES Reference test clean up Use of apv and apu included Aes192KW inclusion LogMessages update in EcdhEs Key Exchange Provider Removed unsued ctors Added direct tests for EcdhEsKeyExchangeProvider Cleaned up reference test Refactoring ctors in EcdhEsKeyExchangeProvider, including new LogMessage Removed unused file that was part of an earlier commit Addressing feed back from PR EcdhKeyExchangeProvider's constructor refactoring: Params for keys are both SecurityKeys, new error message to better describe when we were unable to obtain ECParameters, and some refactoring for readbility. Refactoring for JsonWebTokenHandler.ResolveTokenDecryptionKey for string comparison JwtTokenUtulities.GetSecurityKey refactor for readbility, null clauses for apu amd apv being null, and changed the creating of SymmetricSecurityKey to match with what is already in place for difference cases. Test case scenario for the metnioned above. Removed unnecesary code Adding target for net core 3.1 Copying work from broken topic branch EcdsaKeyWrap Provider Constants Ecdh test Creating EcdhKeyExchangeProvider Removed unnecesary code and comments from ReferenceTests Created Ecdh Security Key Removing EcdhSecurityKey since ECDsaSecurityKey is the same thing Modifying ctor for EcdhKeyExchangeProvider Refactoring + overloads for ctrs in KeyExchangeProvider Differentiate in between ECDH-ES and ECDH-ES+A{128|192|256}KW. Setting AlgorithmID accordingly to alg and enc values. Returning CEK as SecurityKey Changes to Reference test to reflect the changes enc is not optional for key exchange provider apu and apv can be null/empty for generate cek added test for creating a JWE Test cases for Jwe using Ecdh-ES Reference test clean up Use of apv and apu included Aes192KW inclusion LogMessages update in EcdhEs Key Exchange Provider Removed unsued ctors Added direct tests for EcdhEsKeyExchangeProvider Cleaned up reference test Refactoring ctors in EcdhEsKeyExchangeProvider, including new LogMessage Removed unused file that was part of an earlier commit Addressing feed back from PR EcdhKeyExchangeProvider's constructor refactoring: Params for keys are both SecurityKeys, new error message to better describe when we were unable to obtain ECParameters, and some refactoring for readbility. Refactoring for JsonWebTokenHandler.ResolveTokenDecryptionKey for string comparison JwtTokenUtulities.GetSecurityKey refactor for readbility, null clauses for apu amd apv being null, and changed the creating of SymmetricSecurityKey to match with what is already in place for difference cases. Test case scenario for the metnioned above. Removed unnecesary code Adding target for net core 3.1 removing extra letter from rebase Adding NET_CORE defined when using netcore 3.1 Fixing dupe code from rebase onto
- Loading branch information
1 parent
087f414
commit 4cfe7de
Showing
62 changed files
with
1,766 additions
and
112 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
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<SrcTargets>net45;net461;net472;netstandard2.0</SrcTargets> | ||
<SrcTargets>net45;net461;net472;netstandard2.0;netcoreapp3.1</SrcTargets> | ||
<SrcStandardTargets>netstandard2.0</SrcStandardTargets> | ||
</PropertyGroup> | ||
</Project> |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<TestTargets>net452;net461;net472;netcoreapp2.1</TestTargets> | ||
<TestTargets>net452;net461;net472;netcoreapp2.1;netcoreapp3.1</TestTargets> | ||
<TestOnlyCoreTargets>netcoreapp2.1</TestOnlyCoreTargets> | ||
</PropertyGroup> | ||
</Project> |
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
49 changes: 49 additions & 0 deletions
49
src/Microsoft.IdentityModel.Abstractions/IIdentityLogger.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,49 @@ | ||
//------------------------------------------------------------------------------ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// All rights reserved. | ||
// | ||
// This code is licensed under the MIT License. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files(the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions : | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
//------------------------------------------------------------------------------ | ||
|
||
using System.Diagnostics.Tracing; | ||
|
||
namespace Microsoft.IdentityModel.Abstractions | ||
{ | ||
/// <summary> | ||
/// Interface that needs to be implemented by classes providing logging in Microsoft identity libraries. | ||
/// </summary> | ||
public interface IIdentityLogger | ||
{ | ||
/// <summary> | ||
/// Checks to see if logging is enabled at given <paramref name="eventLevel"/>. | ||
/// </summary> | ||
/// <param name="eventLevel">Log level of an Event.</param> | ||
bool IsEnabled(EventLevel eventLevel); | ||
|
||
/// <summary> | ||
/// Writes a log entry. | ||
/// </summary> | ||
/// <param name="entry">Defines a structured message to be logged at the provided <see cref="LogEntry.EventLevel"/>.</param> | ||
void Log(LogEntry entry); | ||
} | ||
} |
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,55 @@ | ||
//------------------------------------------------------------------------------ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// All rights reserved. | ||
// | ||
// This code is licensed under the MIT License. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files(the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions : | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
//------------------------------------------------------------------------------ | ||
|
||
using System.Diagnostics.Tracing; | ||
|
||
namespace Microsoft.IdentityModel.Abstractions | ||
{ | ||
/// <summary> | ||
/// Defines the structure of a log entry. | ||
/// </summary> | ||
public class LogEntry | ||
{ | ||
/// <summary> | ||
/// Defines the <see cref="EventLevel"/>. | ||
/// </summary> | ||
public EventLevel EventLevel { get; set; } | ||
|
||
/// <summary> | ||
/// Message to be logged. | ||
/// </summary> | ||
public string Message { get; set; } | ||
|
||
/// <summary> | ||
/// A unique identifier for a request that can help with diagnostics across components. | ||
/// </summary> | ||
/// <remarks> | ||
/// Also referred to as ActivityId in Microsoft.IdentityModel.Tokens.CallContext. | ||
/// </remarks> | ||
public string CorrelationId { get; set; } | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Microsoft.IdentityModel.Abstractions/Microsoft.IdentityModel.Abstractions.csproj
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,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Import Project="..\..\build\common.props" /> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>Microsoft.IdentityModel.Abstractions</AssemblyName> | ||
<Description>A package containing thin abstractions for Microsoft.IdentityModel.</Description> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<PackageId>Microsoft.IdentityModel.Abstractions</PackageId> | ||
<PackageTags>.NET;Windows;Authentication;Identity;Abstractions</PackageTags> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> | ||
<DebugType>full</DebugType> | ||
<DebugSymbols>true</DebugSymbols> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
</Project> |
53 changes: 53 additions & 0 deletions
53
src/Microsoft.IdentityModel.Abstractions/NullIdentityModelLogger.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,53 @@ | ||
//------------------------------------------------------------------------------ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// All rights reserved. | ||
// | ||
// This code is licensed under the MIT License. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files(the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions : | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
//------------------------------------------------------------------------------ | ||
|
||
using System.Diagnostics.Tracing; | ||
|
||
namespace Microsoft.IdentityModel.Abstractions | ||
{ | ||
/// <summary> | ||
/// A minimalistic <see cref="IIdentityLogger"/> implementation that is disabled by default and doesn't log. | ||
/// </summary> | ||
public sealed class NullIdentityModelLogger : IIdentityLogger | ||
{ | ||
/// <summary> | ||
/// Default instance of <see cref="NullIdentityModelLogger"/>. | ||
/// </summary> | ||
public static NullIdentityModelLogger Instance { get; } = new NullIdentityModelLogger(); | ||
|
||
private NullIdentityModelLogger() { } | ||
|
||
/// <inheritdoc/> | ||
public bool IsEnabled(EventLevel eventLevel) => false; | ||
|
||
/// <inheritdoc/> | ||
public void Log(LogEntry entry) | ||
{ | ||
// no-op | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Microsoft.IdentityModel.Abstractions/Properties/AssemblyInfo.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,37 @@ | ||
//------------------------------------------------------------------------------ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// All rights reserved. | ||
// | ||
// This code is licensed under the MIT License. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files(the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions : | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyInformationalVersion("0.0.1")] | ||
[assembly: AssemblyFileVersion("0.0.1")] | ||
[assembly: AssemblyMetadata("Serviceable", "True")] | ||
[assembly: AssemblyVersion("0.0.1")] | ||
[assembly: CLSCompliant(true)] | ||
[assembly: ComVisible(false)] |
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.