-
Notifications
You must be signed in to change notification settings - Fork 353
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
Add mac broker support and a mac sample app #5051
base: main
Are you sure you want to change the base?
Conversation
src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/DesktopOsHelper.cs
Outdated
Show resolved
Hide resolved
src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/DesktopOsHelper.cs
Show resolved
Hide resolved
src/client/Microsoft.Identity.Client/ApiConfig/BrokerOptions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 19 out of 34 changed files in this pull request and generated no comments.
Files not reviewed (15)
- Mac.sln: Language not supported
- src/client/Microsoft.Identity.Client/PublicApi/net462/PublicAPI.Shipped.txt: Language not supported
- src/client/Microsoft.Identity.Client/PublicApi/net472/PublicAPI.Shipped.txt: Language not supported
- src/client/Microsoft.Identity.Client/PublicApi/net8.0-android/PublicAPI.Shipped.txt: Language not supported
- src/client/Microsoft.Identity.Client/PublicApi/net8.0-ios/PublicAPI.Shipped.txt: Language not supported
- src/client/Microsoft.Identity.Client/PublicApi/net8.0/PublicAPI.Shipped.txt: Language not supported
- src/client/Microsoft.Identity.Client/PublicApi/netstandard2.0/PublicAPI.Shipped.txt: Language not supported
- tests/devapps/MauiMacAppWithBroker/App.xaml: Language not supported
- tests/devapps/MauiMacAppWithBroker/AppShell.xaml: Language not supported
- tests/devapps/MauiMacAppWithBroker/MainPage.xaml: Language not supported
- tests/devapps/MauiMacAppWithBroker/MauiMacAppWithBroker.csproj: Language not supported
- tests/Microsoft.Identity.Test.Common/Core/Helpers/OsHelper.cs: Evaluated as low risk
- src/client/Microsoft.Identity.Client.Broker/RuntimeBroker.cs: Evaluated as low risk
- src/client/Microsoft.Identity.Client.Broker/BrokerExtension.cs: Evaluated as low risk
- src/client/Microsoft.Identity.Client/ApiConfig/BrokerOptions.cs: Evaluated as low risk
Comments suppressed due to low confidence (2)
tests/devapps/MauiMacAppWithBroker/MainPage.xaml.cs:30
- [nitpick] The methods OnACIACSClicked and OnGetAllAccountsClicked have redundant code for building the PublicClientApplicationBuilder. Consider refactoring to avoid repetition.
PublicClientApplicationBuilder builder = PublicClientApplicationBuilder
tests/devapps/MauiMacAppWithBroker/MainPage.xaml.cs:102
- [nitpick] The log file path in SampleLogging is hardcoded. Consider making it configurable.
string homeDirectory = Environment.GetEnvironmentVariable("HOME");
src/client/Microsoft.Identity.Client/PublicApi/net472/PublicAPI.Shipped.txt
Outdated
Show resolved
Hide resolved
src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/DesktopOsHelper.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 1 small issue with IsMac API
- Broker packages need to be updated to reference the new runtime package
Otherwise LGTM
Very much interested in this :) Could you also update the docs page whenever this gets merged ? Also, adding a sample for a console app would be awesome ! |
For the first version, console app scenarios will not be supported. Some crucial |
src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/DesktopOsHelper.cs
Show resolved
Hide resolved
e0605f5
to
9adba3e
Compare
/// <summary> | ||
/// Use broker on OSX | ||
/// </summary> | ||
OSX = 0b_0000_0010, // 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interop package needs to be updated. The current one only has Windows DLLs
https://nuget.info/packages/Microsoft.Identity.Client.NativeInterop/0.17.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like interop 0.18.0 was released and it has Linux x64 support. But no mac support https://nuget.info/packages/Microsoft.Identity.Client.NativeInterop/0.18.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I published a NativeInterop-0.19.0-alpha to IDDP, which contains the mac binaries. (We can discuss the version number separately)
https://dev.azure.com/IdentityDivision/IDDP/_artifacts/feed/IDDP/NuGet/Microsoft.Identity.Client.NativeInterop/overview/0.19.0-alpha
.nupgk was generaged and can be found at https://dev.azure.com/IdentityDivision/IDDP/_build/results?buildId=1436705&view=results under the folder drop_MSALRuntime_Download_Pack_Sign_DotNet_Interop_Sign_interop_package/Nuget/
Our original plan was first publishing all the packages to IDDP, and partners verify everything works fine, then publish to nuget.org. Does this make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interop package needs a bump. See the other PR about Linux broker too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
- CI pipeline integration of the test app is a must.
- As Bogdan mentioned, need an updated Interop with MAC runtimes
- Highly recommend building a broker app with MAC libs/runtimes and testing from within Visual Studio for MAC. Ashok/Chris maybe able to help here with some guidance if needed.
@@ -100,10 +100,22 @@ public RuntimeBroker( | |||
s_lazyCore.Value.EnablePii(_logger.PiiLoggingEnabled); | |||
} | |||
|
|||
_parentHandle = GetParentWindow(uiParent); | |||
if (DesktopOsHelper.IsWindows()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the summary of this method
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
public partial class MainPage : ContentPage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add this dev app to the pipeline, build it, and make sure the interop files are placed in the appropriate folders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we track it with another work item? I created one https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3168507
It's in my epic and will not be forgotten
inUse = true; | ||
|
||
PublicClientApplicationBuilder builder = PublicClientApplicationBuilder | ||
.Create("04b07795-8ddb-461a-bbee-02f9e1bf7b46") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what app is this? can we not use one from the lab?
PublicClientApplicationBuilder builder = PublicClientApplicationBuilder | ||
.Create("04b07795-8ddb-461a-bbee-02f9e1bf7b46") | ||
.WithRedirectUri("msauth.com.msauth.unsignedapp://auth") | ||
.WithClientCapabilities(new[] { "cp1" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need WithClientCapabilities
the request is not even passing any claims or testing the CAE flow
Changes proposed in this request
This PR added the macOS broker support via NativeInterop. Need to work with PR https://github.com/AzureAD/microsoft-authentication-library-for-cpp/pull/4438 to include NativeInterop.proj and get the needed binary files.
Also added a new MAUI sample app calling public APIs to invoke mac broker.
Testing
Performance impact
Documentation