Skip to content

Commit 13eccf3

Browse files
kaisong1990Kai SongKai Songkai
authored
Plugin XPC related UI into MSAL Mac Sample app and update commonCore (#2571)
* Support XPC mode and add MSAL Mac test app inot the xpc app group * Update commoncore * update commot core * add xpc support in sample app * Update submodule * Update property name * Update storyboard and new options for testing app * move UI from bg from test app * Update interactive flow and assign XPC mode value * Update commoncore * Update change log and commoncore * Update MSAL xpc mode naming * switch companion and backup in xpc mode * Update commoncore --------- Co-authored-by: Kai Song <[email protected]> Co-authored-by: Kai Song <[email protected]> Co-authored-by: kai <[email protected]>
1 parent b48916c commit 13eccf3

File tree

10 files changed

+283
-78
lines changed

10 files changed

+283
-78
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## TBD
2+
* Integrate Broker XPC service into Mac Sample app
3+
14
## [2.0.0]
25
* Use a single family refresh token (#2550)
36
* Removed deprecated APIs, including legacy initializers, account management methods and token acquisition methods, and the MSALTelemetry interface (#2577)

MSAL/IdentityCore

Submodule IdentityCore updated 25 files

MSAL/MSAL.xcodeproj/project.pbxproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5959,7 +5959,6 @@
59595959
};
59605960
1E614BD922558D8300EBF62F = {
59615961
CreatedOnToolsVersion = 10.1;
5962-
DevelopmentTeam = UBF8T346G9;
59635962
SystemCapabilities = {
59645963
com.apple.Keychain = {
59655964
enabled = 0;
@@ -8011,12 +8010,13 @@
80118010
CLANG_WARN_UNREACHABLE_CODE = YES;
80128011
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
80138012
CODE_SIGN_ENTITLEMENTS = test/app/mac/MSALMacTestApp.entitlements;
8014-
CODE_SIGN_IDENTITY = "Mac Developer";
8013+
CODE_SIGN_IDENTITY = "Apple Development";
80158014
CODE_SIGN_STYLE = Automatic;
80168015
COMBINE_HIDPI_IMAGES = YES;
80178016
COPY_PHASE_STRIP = NO;
80188017
DEBUG_INFORMATION_FORMAT = dwarf;
80198018
DEVELOPMENT_TEAM = UBF8T346G9;
8019+
ENABLE_HARDENED_RUNTIME = YES;
80208020
ENABLE_STRICT_OBJC_MSGSEND = YES;
80218021
ENABLE_TESTABILITY = YES;
80228022
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -8084,12 +8084,13 @@
80848084
CLANG_WARN_UNREACHABLE_CODE = YES;
80858085
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
80868086
CODE_SIGN_ENTITLEMENTS = test/app/mac/MSALMacTestApp.entitlements;
8087-
CODE_SIGN_IDENTITY = "Mac Developer";
8087+
CODE_SIGN_IDENTITY = "Apple Development";
80888088
CODE_SIGN_STYLE = Automatic;
80898089
COMBINE_HIDPI_IMAGES = YES;
80908090
COPY_PHASE_STRIP = NO;
80918091
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
80928092
DEVELOPMENT_TEAM = UBF8T346G9;
8093+
ENABLE_HARDENED_RUNTIME = YES;
80938094
ENABLE_NS_ASSERTIONS = NO;
80948095
ENABLE_STRICT_OBJC_MSGSEND = YES;
80958096
GCC_C_LANGUAGE_STANDARD = gnu11;

MSAL/MSAL.xcodeproj/xcshareddata/xcschemes/MSAL (Mac Framework).xcscheme

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
3233
BuildableIdentifier = "primary"

MSAL/src/MSALPublicClientApplication.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,16 @@ - (void)acquireTokenSilentWithParameters:(MSALSilentTokenParameters *)parameters
718718
msidParams.validateAuthority = shouldValidate;
719719
msidParams.extendedLifetimeEnabled = self.internalConfig.extendedLifetimeEnabled;
720720
msidParams.clientCapabilities = self.internalConfig.clientApplicationCapabilities;
721+
#if TARGET_OS_OSX && DEBUG
722+
msidParams.xpcMode = (NSUInteger)parameters.msalXpcMode;
723+
#elif TARGET_OS_OSX
724+
if (parameters.msalXpcMode == MSALXpcModePrimary)
725+
{
726+
parameters.msalXpcMode = MSALXpcModeDisabled;
727+
}
728+
729+
msidParams.xpcMode = (NSUInteger)parameters.msalXpcMode;
730+
#endif
721731

722732
// Extra parameters to be added to the /token endpoint.
723733
msidParams.extraTokenRequestParameters = self.internalConfig.extraQueryParameters.extraTokenURLParameters;
@@ -1064,6 +1074,16 @@ - (void)acquireTokenWithParameters:(MSALInteractiveTokenParameters *)parameters
10641074
msidParams.currentRequestTelemetry.schemaVersion = HTTP_REQUEST_TELEMETRY_SCHEMA_VERSION;
10651075
msidParams.currentRequestTelemetry.apiId = [msidParams.telemetryApiId integerValue];
10661076
msidParams.currentRequestTelemetry.tokenCacheRefreshType = TokenCacheRefreshTypeNoCacheLookupInvolved;
1077+
#if TARGET_OS_OSX && DEBUG
1078+
msidParams.xpcMode = (NSUInteger)parameters.msalXpcMode;
1079+
#elif TARGET_OS_OSX
1080+
if (parameters.msalXpcMode == MSALXpcModePrimary)
1081+
{
1082+
parameters.msalXpcMode = MSALXpcModeDisabled;
1083+
}
1084+
1085+
msidParams.xpcMode = (NSUInteger)parameters.msalXpcMode;
1086+
#endif
10671087

10681088
#if TARGET_OS_OSX
10691089
msidParams.clientSku = MSID_CLIENT_SKU_MSAL_OSX;

MSAL/src/public/MSALDefinitions.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,37 @@ typedef NS_ENUM(NSUInteger, MSALPreferredAuthMethod)
194194
MSALPreferredAuthMethodNone
195195
};
196196

197+
#if TARGET_OS_OSX
198+
199+
/**
200+
Preferred Xpc mode for MSAL requests. Can be configured by developers MSAL integration
201+
*/
202+
typedef NS_ENUM(NSUInteger, MSALXpcMode)
203+
{
204+
/*
205+
Broker Xpc service call is disabled
206+
*/
207+
MSALXpcModeDisabled,
208+
/*
209+
Broker Xpc service call is only used as a backup service when SsoExtension service failed.
210+
If SsoExtenion is not available on the device (canPerformRequest returns false), Broker Xpc service call will be disabled
211+
*/
212+
MSALXpcModeSSOExtCompanion,
213+
/*
214+
Broker Xpc service call is used as a backup call when SsoExtension service failed.
215+
If SsoExtenion is not available on the device, Xpc service call will be the primary auth service
216+
*/
217+
MSALXpcModeSSOExtBackup,
218+
219+
/*
220+
Development only: Broker Xpc service is used as main Sso service, and ignored SsoExtension service completely.
221+
This option will be ignored if used in production and will be treated same as MSALXpcModeDisable
222+
*/
223+
MSALXpcModePrimary
224+
};
225+
226+
#endif
227+
197228
/**
198229
The block that gets invoked after MSAL has finished getting a token silently or interactively.
199230
@param result Represents information returned to the application after a successful interactive or silent token acquisition. See `MSALResult` for more information.

MSAL/src/public/MSALTokenParameters.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ NS_ASSUME_NONNULL_BEGIN
8787
*/
8888
@property (nonatomic, nullable) id<MSALAuthenticationSchemeProtocol> authenticationScheme;
8989

90+
#if TARGET_OS_OSX
91+
92+
/**
93+
Broker Xpc service mode defined by developer. This service can be used a backup service on top of today's Entra ID SingleSignOn extension or an isolated service if tenant has no Entra ID SingleSignOn extension deployed
94+
*/
95+
96+
@property (nonatomic) MSALXpcMode msalXpcMode;
97+
98+
#endif
99+
90100
#pragma mark - Creating MSALTokenParameters
91101

92102
/**

0 commit comments

Comments
 (0)