Skip to content

Commit 0e2175f

Browse files
committed
Merge branch 'dev' into jarias/use-single-frt
2 parents 2e732d1 + 4b5b16e commit 0e2175f

24 files changed

+436
-9
lines changed

IdentityCore/src/MSIDBrokerConstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,5 @@ extern NSString * _Nonnull const MSID_CREATE_NEW_URL_SESSION;
104104
extern NSString * _Nonnull const MSID_HTTP_CONNECTION_VALUE;
105105
extern NSString * _Nonnull const MSID_FORCE_REFRESH_KEY;
106106

107+
extern BOOL MSID_SUPPRESS_CAMERA_CONSENT_PROMPT_IN_WEBVIEW;
108+

IdentityCore/src/MSIDBrokerConstants.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,6 @@
104104
// Http header
105105
NSString *const MSID_HTTP_CONNECTION = @"Connection";
106106
NSString *const MSID_HTTP_CONNECTION_VALUE = @"close";
107+
108+
// Non-constant
109+
BOOL MSID_SUPPRESS_CAMERA_CONSENT_PROMPT_IN_WEBVIEW = NO;

IdentityCore/src/MSIDError.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ typedef NS_ENUM(NSInteger, MSIDErrorCode)
171171
*/
172172

173173
MSIDErrorServerUnhandledResponse = -51500,
174+
// http status Code 403 or 404
175+
MSIDErrorUnexpectedHttpResponse = -51501,
174176

175177
/*!
176178
=========================================================
@@ -334,6 +336,24 @@ typedef NS_ENUM(NSInteger, MSIDErrorCode)
334336

335337
// JIT - Error Handling config invalid or not found
336338
MSIDErrorJITErrorHandlingConfigNotFound = -51839,
339+
340+
// Error is thrown when PSSO biometric policy flag mismatches with the config value
341+
MSIDErrorPSSOBiometricPolicyMismatch = -51840,
342+
343+
// Error is thrown when non ENtra passkey extension tries to access the passkey
344+
MSIDErrorPSSOInvalidPasskeyExtension = -51841,
345+
346+
// Error thrown when psso save login config operation fails
347+
MSIDErrorPSSOSaveLoginConfigFailure = -51842,
348+
349+
// Error is thrown when passkey accessed without biometric when h/w biometric policy configured
350+
MSIDErrorPSSOPasskeyLAError = -51843,
351+
352+
// Error is thrown when PSSO user registration attempted with no biometrics configured and sekey biometric policy is configured
353+
MSIDErrorPSSOBiometricsNotEnrolled = -51844,
354+
355+
// Error is thrown when PSSO user registration attempted with no biometrics available and sekey biometric policy is configured
356+
MSIDErrorPSSOBiometricsNotAvailable = -51845,
337357

338358
// Throttling errors
339359
MSIDErrorThrottleCacheNoRecord = -51900,

IdentityCore/src/MSIDError.m

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ MSIDErrorCode MSIDErrorCodeForOAuthErrorWithSubErrorCode(NSString *oauthError, M
207207
@(MSIDErrorDeviceNotPSSORegistered),
208208
@(MSIDErrorPSSOKeyIdMismatch),
209209
@(MSIDErrorJITErrorHandlingConfigNotFound),
210+
@(MSIDErrorPSSOBiometricPolicyMismatch),
211+
@(MSIDErrorPSSOInvalidPasskeyExtension),
212+
@(MSIDErrorPSSOSaveLoginConfigFailure),
213+
@(MSIDErrorPSSOPasskeyLAError),
214+
@(MSIDErrorPSSOBiometricsNotEnrolled),
215+
@(MSIDErrorPSSOBiometricsNotAvailable),
210216
],
211217
MSIDOAuthErrorDomain : @[// Server Errors
212218
@(MSIDErrorServerOauth),
@@ -224,7 +230,8 @@ MSIDErrorCode MSIDErrorCodeForOAuthErrorWithSubErrorCode(NSString *oauthError, M
224230
@(MSIDErrorServerError),
225231
],
226232
MSIDHttpErrorCodeDomain : @[
227-
@(MSIDErrorServerUnhandledResponse)
233+
@(MSIDErrorServerUnhandledResponse),
234+
@(MSIDErrorUnexpectedHttpResponse)
228235
]
229236

230237
// TODO: add new codes here
@@ -301,6 +308,8 @@ void MSIDFillAndLogError(NSError **error, MSIDErrorCode errorCode, NSString *err
301308
// HTTP errors
302309
case MSIDErrorServerUnhandledResponse:
303310
return @"MSIDErrorServerUnhandledResponse";
311+
case MSIDErrorUnexpectedHttpResponse:
312+
return @"MSIDErrorUnexpectedHttpResponse";
304313
// Authority validation errors
305314
case MSIDErrorAuthorityValidation:
306315
return @"MSIDErrorAuthorityValidation";
@@ -415,6 +424,18 @@ void MSIDFillAndLogError(NSError **error, MSIDErrorCode errorCode, NSString *err
415424
return @"MSIDErrorDeviceNotPSSORegistered";
416425
case MSIDErrorPSSOKeyIdMismatch:
417426
return @"MSIDErrorPSSOKeyIdMismatch";
427+
case MSIDErrorPSSOBiometricPolicyMismatch:
428+
return @"MSIDErrorPSSOBiometricPolicyMismatch";
429+
case MSIDErrorPSSOInvalidPasskeyExtension:
430+
return @"MSIDErrorPSSOInvalidPasskeyExtension";
431+
case MSIDErrorPSSOSaveLoginConfigFailure:
432+
return @"MSIDErrorPSSOSaveLoginConfigFailure";
433+
case MSIDErrorPSSOPasskeyLAError:
434+
return @"MSIDErrorPSSOPasskeyLAError";
435+
case MSIDErrorPSSOBiometricsNotEnrolled:
436+
return @"MSIDErrorPSSOBiometricsNotEnrolled";
437+
case MSIDErrorPSSOBiometricsNotAvailable:
438+
return @"MSIDErrorPSSOBiometricsNotAvailable";
418439
// Throttling errors
419440
case MSIDErrorThrottleCacheNoRecord:
420441
return @"MSIDErrorThrottleCacheNoRecord";

IdentityCore/src/broker_operation/response/MSIDDeviceInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef NS_ENUM(NSInteger, MSIDPlatformSSOStatus)
4646
MSIDPlatformSSONotEnabled = 0, //Platform SSO Not enabled in SSO Config
4747
MSIDPlatformSSOEnabledNotRegistered = 1, //Platform SSO Enabled in sso config , but not Registered
4848
MSIDPlatformSSOEnabledAndRegistered = 2, //Platform SSO Enabled in sso config and registered
49+
MSIDPlatformSSORegistrationNeedsRepair = 3, //Platform registration needs to be repaired
4950
};
5051

5152
typedef NS_ENUM(NSInteger, MSIDPreferredAuthMethod)

IdentityCore/src/broker_operation/response/MSIDDeviceInfo.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ - (NSString *)platformSSOStatusStringFromEnum:(MSIDPlatformSSOStatus)platformSSO
176176
return @"platformSSOEnabledNotRegistered";
177177
case MSIDPlatformSSOEnabledAndRegistered:
178178
return @"platformSSOEnabledAndRegistered";
179+
case MSIDPlatformSSORegistrationNeedsRepair:
180+
return @"platformSSORegistrationNeedsRepair";
179181

180182
default:
181183
return nil;
@@ -187,6 +189,7 @@ - (MSIDPlatformSSOStatus)platformSSOStatusEnumFromString:(NSString *)platformSSO
187189
if ([platformSSOStatusString isEqualToString:@"platformSSONotEnabled"]) return MSIDPlatformSSONotEnabled;
188190
if ([platformSSOStatusString isEqualToString:@"platformSSOEnabledNotRegistered"]) return MSIDPlatformSSOEnabledNotRegistered;
189191
if ([platformSSOStatusString isEqualToString:@"platformSSOEnabledAndRegistered"]) return MSIDPlatformSSOEnabledAndRegistered;
192+
if ([platformSSOStatusString isEqualToString:@"platformSSORegistrationNeedsRepair"]) return MSIDPlatformSSORegistrationNeedsRepair;
190193

191194
return MSIDPlatformSSONotEnabled;
192195
}

IdentityCore/src/cache/accessor/MSIDDefaultTokenCacheAccessor.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,10 @@ - (BOOL)saveAccount:(MSIDAccount *)account
14111411
}
14121412
else
14131413
{
1414-
[noReturnAccountsSet addObject:accountCacheItem.username];
1414+
if (accountCacheItem.username)
1415+
{
1416+
[noReturnAccountsSet addObject:accountCacheItem.username];
1417+
}
14151418
}
14161419
}
14171420

IdentityCore/src/network/error_handler/MSIDAADRequestErrorHandler.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,13 @@ - (void)handleError:(NSError *)error
150150
}
151151
}
152152

153-
NSError *httpError = MSIDCreateError(MSIDHttpErrorCodeDomain, MSIDErrorServerUnhandledResponse, errorDescription, nil, nil, nil, context.correlationId, additionalInfo, YES);
153+
NSError *httpUnderlyingError = nil;
154+
if (httpResponse.statusCode == 403 || httpResponse.statusCode == 404)
155+
{
156+
httpUnderlyingError = MSIDCreateError(MSIDHttpErrorCodeDomain, MSIDErrorUnexpectedHttpResponse, errorDescription, nil, nil, nil, context.correlationId, nil, YES);
157+
}
158+
159+
NSError *httpError = MSIDCreateError(MSIDHttpErrorCodeDomain, MSIDErrorServerUnhandledResponse, errorDescription, nil, nil, httpUnderlyingError, context.correlationId, additionalInfo, YES);
154160

155161
if (completionBlock) completionBlock(nil, httpError);
156162
}

IdentityCore/src/webview/embeddedWebview/MSIDOAuth2EmbeddedWebviewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
typedef void (^MSIDNavigationResponseBlock)(NSHTTPURLResponse *response);
3939

4040
@interface MSIDOAuth2EmbeddedWebviewController :
41-
MSIDWebviewUIController <MSIDWebviewInteracting, WKNavigationDelegate>
41+
MSIDWebviewUIController <MSIDWebviewInteracting, WKNavigationDelegate, WKUIDelegate>
4242

4343
typedef NSURLRequest *(^MSIDExternalDecidePolicyForBrowserActionBlock)(MSIDOAuth2EmbeddedWebviewController *webView, NSURL *url);
4444

IdentityCore/src/webview/embeddedWebview/MSIDOAuth2EmbeddedWebviewController.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ -(void)dealloc
108108
{
109109
[self.webView setNavigationDelegate:nil];
110110
}
111+
if ([self.webView.UIDelegate isEqual:self])
112+
{
113+
[self.webView setUIDelegate:nil];
114+
}
111115

112116
self.webView = nil;
113117
}
@@ -175,6 +179,7 @@ - (BOOL)loadView:(NSError *__autoreleasing*)error
175179
BOOL result = [super loadView:error];
176180

177181
self.webView.navigationDelegate = self;
182+
self.webView.UIDelegate = self;
178183

179184
#if !EXCLUDE_FROM_MSALCPP
180185
#if DEBUG
@@ -479,6 +484,22 @@ - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavig
479484
}
480485
}
481486

487+
- (void) webView:(WKWebView *)webView
488+
requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin
489+
initiatedByFrame:(WKFrameInfo *)frame
490+
type:(WKMediaCaptureType)type
491+
decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler API_AVAILABLE(ios(15.0), macos(12.0))
492+
{
493+
if (MSID_SUPPRESS_CAMERA_CONSENT_PROMPT_IN_WEBVIEW && type == WKMediaCaptureTypeCamera)
494+
{
495+
decisionHandler(WKPermissionDecisionGrant);
496+
}
497+
else
498+
{
499+
decisionHandler(WKPermissionDecisionPrompt);
500+
}
501+
}
502+
482503
#pragma mark - Loading Indicator
483504

484505
- (void)onStartLoadingIndicator:(__unused id)sender

0 commit comments

Comments
 (0)