Skip to content

Commit d02817b

Browse files
authored
Merge branch 'dev' into sedemche/browser_core_mats
2 parents 216e986 + 6a54b11 commit d02817b

26 files changed

+399
-74
lines changed

IdentityCore/src/MSIDConstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,10 @@ extern NSString * _Nonnull const MSID_BROWSER_RESPONSE_SWITCH_BROWSER_RESUME;
213213

214214
extern NSString * _Nonnull const MSID_FLIGHT_USE_V2_WEB_RESPONSE_FACTORY;
215215
extern NSString * _Nonnull const MSID_FLIGHT_SUPPORT_DUNA_CBA;
216+
extern NSString * _Nonnull const MSID_FLIGHT_DISABLE_JIT_TROUBLESHOOTING_LEGACY_AUTH;
216217
extern NSString * _Nonnull const MSID_FLIGHT_CLIENT_SFRT_STATUS;
217218
extern NSString * _Nonnull const MSID_FLIGHT_DISABLE_PREFERRED_IDENTITY_CBA;
219+
extern NSString * _Nonnull const MSID_FLIGHT_SUPPORT_STATE_DUNA_CBA;
218220

219221
/**
220222
* Flight to indicate if remove account artifacts should be disabled

IdentityCore/src/MSIDConstants.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@
8585

8686
NSString *const MSID_FLIGHT_USE_V2_WEB_RESPONSE_FACTORY = @"use_v2_web_response_factory";
8787
NSString *const MSID_FLIGHT_SUPPORT_DUNA_CBA = @"support_duna_cba_v2";
88+
NSString *const MSID_FLIGHT_DISABLE_JIT_TROUBLESHOOTING_LEGACY_AUTH = @"disable_jit_remediation_legacy_auth";
8889
NSString *const MSID_FLIGHT_CLIENT_SFRT_STATUS = @"sfrt_v2";
8990
NSString *const MSID_FLIGHT_DISABLE_PREFERRED_IDENTITY_CBA = @"dis_pre_iden_cba";
91+
NSString *const MSID_FLIGHT_SUPPORT_STATE_DUNA_CBA = @"support_state_duna_cba";
9092

9193
// Making the flight string short to avoid legacy broker url size limit
9294
NSString *const MSID_FLIGHT_DISABLE_REMOVE_ACCOUNT_ARTIFACTS = @"disable_rm_metadata";

IdentityCore/src/broker_operation/request/browser_native_message_request/MSIDBrokerOperationBrowserNativeMessageRequest.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ + (NSString *)operation
6161

6262
- (NSString *)callerBundleIdentifier
6363
{
64-
return self.parentProcessBundleIdentifier ?: NSLocalizedString(@"N/A", nil);
64+
return self.parentProcessBundleIdentifier ?: @"";
6565
}
6666

6767
- (NSString *)callerTeamIdentifier
6868
{
69-
return self.parentProcessTeamId ?: NSLocalizedString(@"N/A", nil);
69+
return self.parentProcessTeamId ?: @"";
7070
}
7171

7272
- (NSString *)localizedCallerDisplayName
7373
{
74-
return self.parentProcessLocalizedName ?: NSLocalizedString(@"N/A", nil);
74+
return self.parentProcessLocalizedName ?: @"";
7575
}
7676

7777
- (NSString *)localizedApplicationInfo
@@ -87,7 +87,7 @@ - (NSString *)localizedApplicationInfo
8787
return brokerOperationRequest.localizedApplicationInfo;
8888
}
8989

90-
return NSLocalizedString(@"N/A", nil);
90+
return @"";
9191
}
9292

9393
#pragma mark - MSIDJsonSerializable

IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationBrowserTokenRequest.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ - (instancetype)initWithRequest:(NSURL *)requestURL
5757
_requestURL = requestURL;
5858

5959
[self printRequestURLInfo:requestURL];
60+
if (![httpBody length])
61+
{
62+
// Apple doesn't provide/expose the HTTP method of the request SSO extension intercepted. If httpBody is nil we assume GET else POST.
63+
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, nil, @"[Browser SSO] Request body is empty or undefined. SSO extension will assume HTTP method to GET.");
64+
}
6065

6166
if (![requestValidator shouldHandleURL:_requestURL])
6267
{
@@ -121,8 +126,8 @@ + (NSString *)protocolLogNameForRequestURL:(NSURL *)requestURL
121126
return logProtocolNames[keyword];
122127
}
123128
}
124-
125-
return @"N/A";
129+
NSString *lastPathComponent = [requestURL lastPathComponent];
130+
return [NSString msidIsStringNilOrBlank:lastPathComponent] ? @"N/A" : lastPathComponent;
126131
}
127132

128133
- (void)printRequestURLInfo:(NSURL *)requestURL

IdentityCore/src/cache/accessor/MSIDAccountCredentialCache.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ - (MSIDIsFRTEnabledStatus)checkFRTEnabled:(nullable id<MSIDRequestContext>)conte
581581

582582
if ([NSString msidIsStringNilOrBlank:flagEnableFRT] || (!shouldEnableFRT && !shouldDisableFRT))
583583
{
584-
MSID_LOG_WITH_CTX(MSIDLogLevelError, context, @"FRT flight set to keep current status: %ld", (long)status);
584+
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, context, @"FRT flight set to keep current status: %ld", (long)status);
585585
return status;
586586
}
587587
MSIDIsFRTEnabledStatus newStatus = status;

IdentityCore/src/oauth2/aad_base/MSIDAADWebviewFactory.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,14 @@ - (MSIDWebviewResponse *)oAuthResponseWithURL:(NSURL *)url
206206
{
207207
MSIDSwitchBrowserResponse *switchBrowserResponse = [[MSIDSwitchBrowserResponse alloc] initWithURL:url
208208
redirectUri:endRedirectUri
209+
requestState:requestState
209210
context:context
210211
error:nil];
211212
if (switchBrowserResponse) return switchBrowserResponse;
212213

213214
MSIDSwitchBrowserResumeResponse *switchBrowserResumeResponse = [[MSIDSwitchBrowserResumeResponse alloc] initWithURL:url
214215
redirectUri:endRedirectUri
216+
requestState:requestState
215217
context:context
216218
error:nil];
217219
if (switchBrowserResumeResponse) return switchBrowserResumeResponse;

IdentityCore/src/requests/MSIDEcdhApv.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727

2828
@implementation MSIDEcdhApv
2929

30-
const NSUInteger kExpectedECP256KeyLength = 65;
31-
3230
- (instancetype)initWithKey:(SecKeyRef)publicKey
3331
apvPrefix:(NSString *)apvPrefix
3432
context:(id<MSIDRequestContext> _Nullable)context
3533
error:(NSError * _Nullable __autoreleasing *)error
3634
{
35+
const NSUInteger kExpectedECP256KeyLength = 65;
36+
3737
if (publicKey == NULL)
3838
{
3939
if (error) *error = MSIDCreateError(MSIDErrorDomain, MSIDErrorInternal, @"Public STK provided is not defined.", nil, nil, nil, context.correlationId, nil, NO);

IdentityCore/src/webview/MSIDCertAuthManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
4444
- (void)startWithURL:(NSURL *)startURL
4545
parentController:(MSIDViewController *)parentViewController
4646
context:(id<MSIDRequestContext>)context
47+
ephemeralWebBrowserSession:(BOOL)ephemeralWebBrowserSession
4748
completionBlock:(MSIDWebUICompletionHandler)completionBlock;
4849

4950
- (BOOL)completeWithCallbackURL:(NSURL *)url;

IdentityCore/src/webview/MSIDCertAuthManager.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ - (BOOL)completeWithCallbackURL:(NSURL *)url
7979
- (void)startWithURL:(NSURL *)startURL
8080
parentController:(MSIDViewController *)parentViewController
8181
context:(id<MSIDRequestContext>)context
82+
ephemeralWebBrowserSession:(BOOL)ephemeralWebBrowserSession
8283
completionBlock:(MSIDWebUICompletionHandler)completionBlock
8384
{
8485
[MSIDMainThreadUtil executeOnMainThreadIfNeeded:^{
@@ -113,7 +114,7 @@ - (void)startWithURL:(NSURL *)startURL
113114
parentController:parentViewController
114115
useAuthenticationSession:self.useAuthSession
115116
allowSafariViewController:YES
116-
ephemeralWebBrowserSession:YES
117+
ephemeralWebBrowserSession:ephemeralWebBrowserSession
117118
context:context];
118119

119120
self.systemWebViewController.appActivities = self.activities;

IdentityCore/src/webview/embeddedWebview/MSIDAADOAuthEmbeddedWebviewController.m

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#import "MSIDWorkPlaceJoinConstants.h"
3030
#import "MSIDPKeyAuthHandler.h"
3131
#import "MSIDWorkPlaceJoinUtil.h"
32+
#import "MSIDWebAuthNUtil.h"
33+
#import "MSIDFlightManager.h"
34+
#import "MSIDConstants.h"
3235

3336
#if !MSID_EXCLUDE_WEBKIT
3437

@@ -67,6 +70,28 @@ - (BOOL)decidePolicyAADForNavigationAction:(WKNavigationAction *)navigationActio
6770
BOOL isBrokerUrl = [@"msauth" caseInsensitiveCompare:requestURL.scheme] == NSOrderedSame;
6871
BOOL isBrowserUrl = [@"browser" caseInsensitiveCompare:requestURL.scheme] == NSOrderedSame;
6972

73+
if (![MSIDFlightManager.sharedInstance boolForKey:MSID_FLIGHT_DISABLE_JIT_TROUBLESHOOTING_LEGACY_AUTH])
74+
{
75+
// When not running in SSO extension, the CA block page will return with "https" scheme instead of "browser"
76+
if (requestURL && ![MSIDWebAuthNUtil amIRunningInExtension] &&
77+
self.externalDecidePolicyForBrowserAction &&
78+
[@"https" caseInsensitiveCompare:requestURL.scheme] == NSOrderedSame)
79+
{
80+
// Create new URL replacing 'https' scheme with 'browser' scheme
81+
NSURL *legacyFlowUrl = [NSURL URLWithString:[NSString stringWithFormat:@"browser%@", [requestURL.absoluteString substringFromIndex:5]]];
82+
NSURLRequest *challengeResponse = self.externalDecidePolicyForBrowserAction(self, legacyFlowUrl);
83+
84+
if (challengeResponse)
85+
{
86+
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, self.context, @"Found AAD policy for navigation using https url and externalDecidePolicyForBrowserAction in legacy auth flow.");
87+
decisionHandler(WKNavigationActionPolicyCancel);
88+
[self loadRequest:challengeResponse];
89+
90+
return YES;
91+
}
92+
}
93+
}
94+
7095
if (isBrokerUrl || isBrowserUrl)
7196
{
7297
// Let external code decide if browser url is allowed to continue

0 commit comments

Comments
 (0)