Skip to content

Commit

Permalink
Update Azure.Identity (Azure#19547)
Browse files Browse the repository at this point in the history
* Update Azure.Identity

* Update ChangeLog.md

* Update after review

Co-authored-by: Yunchi Wang <54880216+wyunchi-ms@users.noreply.github.com>
  • Loading branch information
dingmeng-xue and wyunchi-ms committed Sep 22, 2022
1 parent b48051b commit 3f3e61b
Show file tree
Hide file tree
Showing 25 changed files with 14 additions and 1,747 deletions.
1 change: 1 addition & 0 deletions src/Accounts/Accounts/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

## Upcoming Release
* Supported tenant domain as input while using `Connect-AzAccount` with parameter `Tenant`. [#19471]
* Upgraded Azure.Identity to 1.6.1
* Changed target framework of AuthenticationAssemblyLoadContext to netcoreapp3.1.

## Version 2.10.1
Expand Down
2 changes: 1 addition & 1 deletion src/Accounts/Authentication/Authentication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.6.0" />
<PackageReference Include="Azure.Identity" Version="1.6.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class CustomAssemblyResolver
new Dictionary<string, Version>(StringComparer.InvariantCultureIgnoreCase)
{
{"Azure.Core", new Version("1.25.0.0")},
{"Azure.Identity", new Version("1.6.1.0")},
{"Microsoft.Bcl.AsyncInterfaces", new Version("1.1.1.0")},
{"Microsoft.Identity.Client", new Version("4.39.0.0") },
{"Microsoft.Identity.Client.Extensions.Msal", new Version("2.19.3.0") },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static AzAssemblyLoadContextInitializer()
var azSharedAssemblies = new Dictionary<string, Version>()
{
{"Azure.Core", new Version("1.25.0.0")},
{"Azure.Identity", new Version("1.6.0.0")},
{"Azure.Identity", new Version("1.6.1.0")},
{"Microsoft.Bcl.AsyncInterfaces", new Version("1.1.1.0")},
{"Microsoft.Identity.Client", new Version("4.39.0.0") },
{"Microsoft.Identity.Client.Extensions.Msal", new Version("2.19.3.0") },
Expand Down
4 changes: 0 additions & 4 deletions src/Accounts/Authenticators/Authenticators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
<DefineConstants>TRACE;RELEASE;NETSTANDARD;SIGN</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.6.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Authentication\Authentication.csproj" />
</ItemGroup>
Expand Down
19 changes: 10 additions & 9 deletions src/Accounts/Authenticators/ClientAssertionAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;

using Azure.Core;
using Azure.Identity;
using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.PowerShell.Authenticators.Factories;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.Identity.Client;
using Microsoft.Azure.PowerShell.Authenticators.Identity;
using ClientAssertionCredential = Microsoft.Azure.PowerShell.Authenticators.Identity.ClientAssertionCredential;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.Azure.PowerShell.Authenticators
{
Expand All @@ -45,7 +40,7 @@ public override Task<IAccessToken> Authenticate(AuthenticationParameters paramet
var requestContext = new TokenRequestContext(scopes);
AzureSession.Instance.TryGetComponent(nameof(AzureCredentialFactory), out AzureCredentialFactory azureCredentialFactory);

TokenCredential tokenCredential = new ClientAssertionCredential(tenantId, spParameters.ClientId, spParameters.ClientAssertion.ConvertToString());
TokenCredential tokenCredential = new ClientAssertionCredential(tenantId, spParameters.ClientId, () => GetClientAssertion(spParameters));
string parametersLog = $"- ClientId:'{spParameters.ClientId}', TenantId:'{tenantId}', ClientAssertion:'***' Scopes:'{string.Join(",", scopes)}'";
return MsalAccessToken.GetAccessTokenAsync(
nameof(ClientAssertionAuthenticator),
Expand All @@ -61,5 +56,11 @@ public override bool CanAuthenticate(AuthenticationParameters parameters)
{
return (parameters as ClientAssertionParameters) != null;
}

private string GetClientAssertion(ClientAssertionParameters parameters)
{
return parameters.ClientAssertion.ConvertToString();
}

}
}
194 changes: 0 additions & 194 deletions src/Accounts/Authenticators/Identity/AsyncLockWithValue.cs

This file was deleted.

Loading

0 comments on commit 3f3e61b

Please sign in to comment.