Skip to content

Commit

Permalink
Azure.Identity.Broker archboard feedback (#39296)
Browse files Browse the repository at this point in the history
  • Loading branch information
christothes authored Oct 18, 2023
1 parent 40a2633 commit c6566ac
Show file tree
Hide file tree
Showing 23 changed files with 54 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
### Features Added

### Breaking Changes
- Renamed the `IsMsaPassthroughEnabled` property on `InteractiveBrowserCredentialBrokerOptions` to `IsLegacyMsaPassthroughEnabled`.

### Bugs Fixed

### Other Changes
- Updated Microsoft.Identity.Client.Broker and Microsoft.Identity.Client.Extensions.Msal dependencies to version 4.56.0
- Renamed assembly from `Azure.Identity.BrokeredAuthentication` to `Azure.Identity.Broker`.

## 1.0.0-beta.4 (2023-07-17)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
Install the Azure Identity client library for .NET with [NuGet][nuget]:

```PowerShell
dotnet add package Azure.Identity.BrokeredAuthentication --prerelease
dotnet add package Azure.Identity.Broker --prerelease
```

### Prerequisites
* The [Azure.Identity][azure_identity] library is a dependency of Azure.Identity.BrokeredAuthentication.
* The [Azure.Identity][azure_identity] library is a dependency of Azure.Identity.Broker.

### Authenticate the client

Expand Down Expand Up @@ -125,8 +125,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[azure_powerShell]: https://docs.microsoft.com/powershell/azure
[azure_sub]: https://azure.microsoft.com/free/dotnet/
[azure_identity]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity/README.md
[source]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity.BrokeredAuthentication/src
[package]: https://www.nuget.org/packages?q=Azure.Identity.BrokeredAuthentication
[source]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity.Broker/src
[package]: https://www.nuget.org/packages?q=Azure.Identity.Broker
[aad_doc]: https://docs.microsoft.com/azure/active-directory/
[aad_err_doc]: https://docs.microsoft.com/azure/active-directory/develop/reference-aadsts-error-codes
[certificates_client_library]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/keyvault/Azure.Security.KeyVault.Certificates
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Azure.Identity.BrokeredAuthentication
namespace Azure.Identity.Broker
{
public partial class InteractiveBrowserCredentialBrokerOptions : Azure.Identity.InteractiveBrowserCredentialOptions
{
public InteractiveBrowserCredentialBrokerOptions(System.IntPtr parentWindowHandle) { }
public bool? IsMsaPassthroughEnabled { get { throw null; } set { } }
public bool? IsLegacyMsaPassthroughEnabled { get { throw null; } set { } }
}
public partial class SharedTokenCacheCredentialBrokerOptions : Azure.Identity.SharedTokenCacheCredentialOptions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Azure.Identity.BrokeredAuthentication
namespace Azure.Identity.Broker
{
public partial class InteractiveBrowserCredentialBrokerOptions : Azure.Identity.InteractiveBrowserCredentialOptions
{
public InteractiveBrowserCredentialBrokerOptions(System.IntPtr parentWindowHandle) { }
public bool? IsMsaPassthroughEnabled { get { throw null; } set { } }
public bool? IsLegacyMsaPassthroughEnabled { get { throw null; } set { } }
}
public partial class SharedTokenCacheCredentialBrokerOptions : Azure.Identity.SharedTokenCacheCredentialOptions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Azure.Identity.BrokeredAuthentication
namespace Azure.Identity.Broker
{
public partial class InteractiveBrowserCredentialBrokerOptions : Azure.Identity.InteractiveBrowserCredentialOptions
{
public InteractiveBrowserCredentialBrokerOptions(System.IntPtr parentWindowHandle) { }
public bool? IsMsaPassthroughEnabled { get { throw null; } set { } }
public bool? IsLegacyMsaPassthroughEnabled { get { throw null; } set { } }
}
public partial class SharedTokenCacheCredentialBrokerOptions : Azure.Identity.SharedTokenCacheCredentialOptions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>This is the implementation of the Azure SDK Client Library for Azure Identity</Description>
<AssemblyTitle>Microsoft Azure.Identity.BrokeredAuthentication Component</AssemblyTitle>
<AssemblyTitle>Microsoft Azure.Identity.Broker Component</AssemblyTitle>
<Version>1.0.0-beta.5</Version>
<PackageTags>Microsoft Azure Identity Broker;$(PackageCommonTags)</PackageTags>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(RequiredTargetFrameworks);net462;net6.0</TargetFrameworks>
Expand All @@ -12,7 +12,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Identity" />
<!-- Revert project reference when Azure.Identity ships with updated InternalsVisibleTo -->
<!-- <PackageReference Include="Azure.Identity" /> -->
<ProjectReference Include="..\..\Azure.Identity\src\Azure.Identity.csproj" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Threading.Tasks.Extensions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Identity.Client;
using Microsoft.Identity.Client.Broker;

namespace Azure.Identity.BrokeredAuthentication
namespace Azure.Identity.Broker
{
/// <summary>
/// Options to configure the <see cref="InteractiveBrowserCredential"/> to use the system authentication broker in lieu of the system browser if available.
Expand All @@ -18,7 +18,7 @@ public class InteractiveBrowserCredentialBrokerOptions : InteractiveBrowserCrede
/// Gets or sets whether Microsoft Account (MSA) passthrough is enabled.
/// </summary>
/// <value></value>
public bool? IsMsaPassthroughEnabled { get; set; }
public bool? IsLegacyMsaPassthroughEnabled { get; set; }

/// <summary>
/// Creates a new instance of <see cref="InteractiveBrowserCredentialBrokerOptions"/> to configure a <see cref="InteractiveBrowserCredential"/>.
Expand All @@ -35,9 +35,9 @@ private void AddBroker(PublicClientApplicationBuilder builder)
{
builder.WithParentActivityOrWindow(() => _parentWindowHandle);
var options = new BrokerOptions(BrokerOptions.OperatingSystems.Windows);
if (IsMsaPassthroughEnabled.HasValue)
if (IsLegacyMsaPassthroughEnabled.HasValue)
{
options.MsaPassthrough = IsMsaPassthroughEnabled.Value;
options.MsaPassthrough = IsLegacyMsaPassthroughEnabled.Value;
}
builder.WithBroker(options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Identity.Client;
using Microsoft.Identity.Client.Broker;

namespace Azure.Identity.BrokeredAuthentication
namespace Azure.Identity.Broker
{
/// <summary>
/// Options to configure the <see cref="SharedTokenCacheCredential"/> to use the system authentication broker for silent authentication if available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
<PackageReference Include="Azure.Security.KeyVault.Secrets" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
<ProjectReference Include="..\..\Azure.Identity\src\Azure.Identity.csproj" />
<ProjectReference Include="..\src\Azure.Identity.BrokeredAuthentication.csproj" />
<ProjectReference Include="..\src\Azure.Identity.Broker.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="*.cs" Exclude="*Manual*.cs"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.Identity.Client;
using NUnit.Framework;

namespace Azure.Identity.BrokeredAuthentication.Tests
namespace Azure.Identity.Broker.Tests
{
public class InteractiveBrowserCredentialBrokerOptionsTests
{
Expand All @@ -18,7 +18,7 @@ public void RespectsMsaPassthrough(
IMsalPublicClientInitializerOptions credentialOptions;
if (enableMsaPassthrough.HasValue)
{
credentialOptions = new InteractiveBrowserCredentialBrokerOptions(parentWindowHandle) { IsMsaPassthroughEnabled = enableMsaPassthrough.Value } as IMsalPublicClientInitializerOptions;
credentialOptions = new InteractiveBrowserCredentialBrokerOptions(parentWindowHandle) { IsLegacyMsaPassthroughEnabled = enableMsaPassthrough.Value } as IMsalPublicClientInitializerOptions;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Azure.Core;
using NUnit.Framework;

namespace Azure.Identity.BrokeredAuthentication.Tests
namespace Azure.Identity.Broker.Tests
{
public class ManualInteractiveBrowserCredentialBrokerTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Azure.Core;
using NUnit.Framework;

namespace Azure.Identity.BrokeredAuthentication.Tests
namespace Azure.Identity.Broker.Tests
{
public class ManualSharedTokenCacheCredentialBrokerTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.Identity.Client;
using NUnit.Framework;

namespace Azure.Identity.BrokeredAuthentication.Tests
namespace Azure.Identity.Broker.Tests
{
public class SharedTokenCacheCredentialBrokerOptionsTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;
using System.Runtime.InteropServices;
using Azure.Identity.BrokeredAuthentication;
using Azure.Identity.Broker;
using Azure.Security.KeyVault.Secrets;
using NUnit.Framework;

Expand Down

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions sdk/identity/Azure.Identity.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity.Perf", "Azur
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj", "{D181301A-2FA4-420D-963F-529445E61409}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity.BrokeredAuthentication", "Azure.Identity.BrokeredAuthentication\src\Azure.Identity.BrokeredAuthentication.csproj", "{2337B615-724F-4ED7-8929-B1AF89815D30}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity.Broker", "Azure.Identity.Broker\src\Azure.Identity.Broker.csproj", "{2337B615-724F-4ED7-8929-B1AF89815D30}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity.BrokeredAuthentication.Tests", "Azure.Identity.BrokeredAuthentication\tests\Azure.Identity.BrokeredAuthentication.Tests.csproj", "{5F72962A-E4A5-4DBD-BA00-AB5B7725CACA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity.Broker.Tests", "Azure.Identity.Broker\tests\Azure.Identity.Broker.Tests.csproj", "{5F72962A-E4A5-4DBD-BA00-AB5B7725CACA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Core", "..\core\Azure.Core\src\Azure.Core.csproj", "{B8BF1ED4-DD68-4504-9060-008D1A980958}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/Azure.Identity/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ If you choose "Use another account" and type in an MSA outlook.com account, it f

![Fail on use another account](./images/MSA2.png)

Since version `1.0.0-beta.4` of [Azure.Identity.BrokeredAuthentication](https://www.nuget.org/packages/Azure.Identity.BrokeredAuthentication), you can set the `IsMsaPassthroughEnabled` property on `InteractiveBrowserCredentialBrokerOptions` or `SharedTokenCacheCredentialBrokerOptions` to `true`. MSA outlook.com accounts that are logged in to Windows are automatically listed:
Since version `1.0.0-beta.4` of [Azure.Identity.Broker](https://www.nuget.org/packages/Azure.Identity.BrokeredAuthentication), you can set the `IsMsaPassthroughEnabled` property on `InteractiveBrowserCredentialBrokerOptions` or `SharedTokenCacheCredentialBrokerOptions` to `true`. MSA outlook.com accounts that are logged in to Windows are automatically listed:

![Enable MSA](./images/MSA3.png)

Expand Down
18 changes: 18 additions & 0 deletions sdk/identity/Azure.Identity/src/FriendAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;

namespace Azure
{
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
internal class FriendAttribute : Attribute
{
public FriendAttribute(string friendAssembly)
{
FriendAssembly = friendAssembly;
}

public string FriendAssembly { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Identity.Client;

namespace Azure.Identity
{
[Friend("Azure.Identity.Broker")]
internal interface IMsalPublicClientInitializerOptions
{
Action<PublicClientApplicationBuilder> BeforeBuildClient { get; }
Expand Down
2 changes: 2 additions & 0 deletions sdk/identity/Azure.Identity/src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

[assembly: InternalsVisibleTo("Microsoft.Extensions.Azure.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("Azure.Identity.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("Azure.Identity.Broker, PublicKey=0024000004800000940000000602000000240000525341310004000001000100097ad52abbeaa2e1a1982747cc0106534f65cfea6707eaed696a3a63daea80de2512746801a7e47f88e7781e71af960d89ba2e25561f70b0e2dbc93319e0af1961a719ccf5a4d28709b2b57a5d29b7c09dc8d269a490ebe2651c4b6e6738c27c5fb2c02469fe9757f0a3479ac310d6588a50a28d7dd431b907fd325e18b9e8ed")]
[assembly: InternalsVisibleTo("Azure.Identity.Broker.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("Azure.Identity.BrokeredAuthentication, PublicKey=0024000004800000940000000602000000240000525341310004000001000100097ad52abbeaa2e1a1982747cc0106534f65cfea6707eaed696a3a63daea80de2512746801a7e47f88e7781e71af960d89ba2e25561f70b0e2dbc93319e0af1961a719ccf5a4d28709b2b57a5d29b7c09dc8d269a490ebe2651c4b6e6738c27c5fb2c02469fe9757f0a3479ac310d6588a50a28d7dd431b907fd325e18b9e8ed")]
[assembly: InternalsVisibleTo("Azure.Identity.BrokeredAuthentication.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
Expand Down
4 changes: 2 additions & 2 deletions sdk/identity/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ extends:
Artifacts:
- name: Azure.Identity
safeName: AzureIdentity
- name: Azure.Identity.BrokeredAuthentication
safeName: AzureIdentityBrokeredAuthentication
- name: Azure.Identity.Broker
safeName: AzureIdentityBroker

0 comments on commit c6566ac

Please sign in to comment.