Skip to content

Commit 17e3520

Browse files
anaismillerjsquire
andauthored
AppAuth 1.6.2 release (Azure#23794)
* overriding IMDS proxy settings * Update README.md Add Azure Identity library information * update nuget packages * encrypted token tenant fix * 1.6.2 release * add additional scenarios * test fix * Update sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Microsoft.Azure.Services.AppAuthentication.csproj Co-authored-by: Jesse Squire <jesse.squire@gmail.com> * Update sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Properties/AssemblyInfo.cs Co-authored-by: Jesse Squire <jesse.squire@gmail.com> * Update sdk/mgmtcommon/AppAuthentication/README.md Co-authored-by: Jesse Squire <jesse.squire@gmail.com> * Update sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/AccessToken.cs Co-authored-by: Jesse Squire <jesse.squire@gmail.com> * Update sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/TokenProviders/ClientCertificateAccessTokenProvider.cs Co-authored-by: Jesse Squire <jesse.squire@gmail.com> Co-authored-by: Jesse Squire <jesse.squire@gmail.com>
1 parent e12c8ee commit 17e3520

File tree

10 files changed

+63
-28
lines changed

10 files changed

+63
-28
lines changed

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication.IntegrationTests/Helpers/GraphHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public async Task<Application> CreateApplicationAsync(string secret)
4141
Application newApp = new Application
4242
{
4343
DisplayName = $"Microsoft.Azure.Services.AppAuthentication.Test{guid}",
44-
IdentifierUris = new List<string> { $"https://Microsoft.Azure.Services.AppAuthentication/{guid}" },
45-
ReplyUrls = new List<string> { "https://Microsoft.Azure.Services.AppAuthentication/" },
44+
IdentifierUris = new List<string> { $"https://microsoft.com/{guid}" },
45+
ReplyUrls = new List<string> { "https://microsoft.com/" },
4646
OdataType = "Microsoft.DirectoryServices.Application",
4747
AppRolesODataType = "Collection(Microsoft.DirectoryServices.AppRole)",
4848
IdentifierUrisODataType = "Collection(Edm.String)",
@@ -75,8 +75,8 @@ public async Task<Application> CreateApplicationAsync(X509Certificate2 cert)
7575
Application newApp = new Application
7676
{
7777
DisplayName = $"Microsoft.Azure.Services.AppAuthentication.Test{guid}",
78-
IdentifierUris = new List<string> { $"https://localhost/demo/{guid}" },
79-
ReplyUrls = new List<string> { "https://localhost/demo" },
78+
IdentifierUris = new List<string> { $"https://microsoft.com/demo/{guid}" },
79+
ReplyUrls = new List<string> { "https://microsoft.com/demo" },
8080
OdataType = "Microsoft.DirectoryServices.Application",
8181
AppRolesODataType = "Collection(Microsoft.DirectoryServices.AppRole)",
8282
IdentifierUrisODataType = "Collection(Edm.String)",

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication.IntegrationTests/Microsoft.Azure.Services.AppAuthentication.IntegrationTests.csproj

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
99
</PropertyGroup>
1010
<PropertyGroup>
11-
<ExcludeFromBuild/>
11+
<ExcludeFromBuild />
1212
<ExcludeFromTest>true</ExcludeFromTest>
1313
</PropertyGroup>
1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.KeyVault" Version="2.3.2" />
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
17-
<PackageReference Include="xUnit" Version="2.3.1" />
18-
<PackageReference Include="xUnit.Runner.VisualStudio" Version="2.3.1" />
19-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
15+
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.2" />
17+
<PackageReference Include="xUnit" Version="2.4.1" />
18+
<PackageReference Include="xUnit.Runner.VisualStudio" Version="2.4.1">
19+
<PrivateAssets>all</PrivateAssets>
20+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21+
</PackageReference>
22+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
2023
</ItemGroup>
2124
<ItemGroup>
2225
<ProjectReference Include="..\Azure.Services.AppAuthentication.TestCommon\Microsoft.Azure.Services.AppAuthentication.TestCommon.csproj" />

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication.TestCommon/Microsoft.Azure.Services.AppAuthentication.TestCommon.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
<ExcludeFromTest>true</ExcludeFromTest>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
14-
<PackageReference Include="xUnit" Version="2.3.1" />
15-
<PackageReference Include="xUnit.Runner.VisualStudio" Version="2.3.1" />
16-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.2" />
14+
<PackageReference Include="xUnit" Version="2.4.1" />
15+
<PackageReference Include="xUnit.Runner.VisualStudio" Version="2.4.1">
16+
<PrivateAssets>all</PrivateAssets>
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
</PackageReference>
19+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
1720
</ItemGroup>
1821
<ItemGroup>
1922
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication.Unit.Tests/Microsoft.Azure.Services.AppAuthentication.Unit.Tests.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
<ProjectReference Include="..\Azure.Services.AppAuthentication\Microsoft.Azure.Services.AppAuthentication.csproj" />
1717
</ItemGroup>
1818
<ItemGroup>
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
20-
<PackageReference Include="xUnit" Version="2.3.1" />
21-
<PackageReference Include="xUnit.Runner.VisualStudio" Version="2.3.1" />
22-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.2" />
20+
<PackageReference Include="xUnit" Version="2.4.1" />
21+
<PackageReference Include="xUnit.Runner.VisualStudio" Version="2.4.1">
22+
<PrivateAssets>all</PrivateAssets>
23+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24+
</PackageReference>
25+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
2326
</ItemGroup>
2427
<ItemGroup>
2528
<Reference Include="System.Net.Http" />

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/AccessToken.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ public override string ToString()
9999
return _accessToken;
100100
}
101101

102+
/// <summary>
103+
/// Return the deserialized tenantId if accessible
104+
/// </summary>
105+
/// <param name="accessToken">AccessToken to deserialize.</param>
106+
/// <returns></returns>
107+
public static string TenantIdInfo(string accessToken)
108+
{
109+
// From some scenarios, cannot access the tenantId, but valid token ie. encrypted tokens
110+
try
111+
{
112+
return AccessToken.Parse(accessToken).TenantId;
113+
}
114+
catch (FormatException)
115+
{
116+
return "Hidden";
117+
}
118+
}
119+
102120
/// <summary>
103121
/// Check if the token is about to expire
104122
/// </summary>

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Microsoft.Azure.Services.AppAuthentication.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<PackageId>Microsoft.Azure.Services.AppAuthentication</PackageId>
4-
<Description>Enables a service to authenticate to Azure services using the developer's Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.0 Client Credentials flow) when deployed to Azure.</Description>
5-
<Version>1.6.1</Version>
4+
<Description>There is a newer version of this library available here: https://www.nuget.org/packages/Azure.Identity/
5+
Migration guide: https://docs.microsoft.com/dotnet/api/overview/azure/app-auth-migration
6+
AppAuth no longer receives new feature improvements. Enables a service to authenticate to Azure services using the developer's Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.0 Client Credentials flow) when deployed to Azure.</Description>
7+
<Version>1.6.2</Version>
68
<AssemblyName>Microsoft.Azure.Services.AppAuthentication</AssemblyName>
79
<PackageTags>Azure Authentication AppAuthentication</PackageTags>
810
<PackageReleaseNotes>
@@ -21,8 +23,8 @@
2123
</PropertyGroup>
2224

2325
<ItemGroup>
24-
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.0" />
25-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
26+
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.9" />
27+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
2628
</ItemGroup>
2729

2830
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
using System.Runtime.CompilerServices;
33

44
[assembly: AssemblyTitle("Microsoft.Azure.Services.AppAuthentication")]
5-
[assembly: AssemblyDescription("Enables a service to authenticate to Azure services using the developer's Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.0 Client Credentials flow) when deployed to Azure.")]
5+
[assembly: AssemblyDescription("There is a newer version of this library available here: https://www.nuget.org/packages/Azure.Identity/ " +
6+
"Migration guide: https://docs.microsoft.com/dotnet/api/overview/azure/app-auth-migration " +
7+
"AppAuth no longer receives new feature improvements." +
8+
"Enables a service to authenticate to Azure services using the developer's Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.0 Client Credentials flow) when deployed to Azure.")]
69

7-
[assembly: AssemblyVersion("1.6.1.0")]
8-
[assembly: AssemblyFileVersion("1.6.1.0")]
10+
[assembly: AssemblyVersion("1.6.2.0")]
11+
[assembly: AssemblyFileVersion("1.6.2.0")]
912
[assembly: AssemblyCompany("Microsoft Corporation")]
1013
[assembly: AssemblyProduct("Microsoft Azure")]
1114
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/TokenProviders/ClientCertificateAccessTokenProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ await _authenticationContext.AcquireTokenAsync(authority, resource, certCred)
194194
{
195195
PrincipalUsed.CertificateThumbprint = cert.Thumbprint;
196196
PrincipalUsed.IsAuthenticated = true;
197-
PrincipalUsed.TenantId = AccessToken.Parse(accessToken).TenantId;
198-
197+
PrincipalUsed.TenantId = AccessToken.TenantIdInfo(accessToken);
199198
return authResult;
200199
}
201200
}

sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/TokenProviders/ClientSecretAccessTokenProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public override async Task<AppAuthenticationResult> GetAuthResultAsync(string re
6767
if (accessToken != null)
6868
{
6969
PrincipalUsed.IsAuthenticated = true;
70-
PrincipalUsed.TenantId = AccessToken.Parse(accessToken).TenantId;
70+
PrincipalUsed.TenantId = AccessToken.TenantIdInfo(accessToken);
7171

7272
return authResult;
7373
}

sdk/mgmtcommon/AppAuthentication/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Microsoft.Azure.Services.AppAuthentication Library
22

3+
### Note
4+
This library is no longer recommended to use with the new Azure SDK. It is replaced with the new **Azure Identity client library** available for .NET, Java, TypeScript and Python and should be used for all new development. Information about how to migrate to `Azure.Identity` can be found here: [AppAuthentication to Azure.Identity Migration Guidance](https://docs.microsoft.com/dotnet/api/overview/azure/app-auth-migration).
5+
***
6+
37
### Purpose
48
Make it easy to authenticate to Azure Services (that support Azure AD Authentication), and help avoid credentials in source code and configuration files.
59

0 commit comments

Comments
 (0)