Skip to content

Commit bbc0915

Browse files
authored
Merge pull request #1538 from AzureAD/mipetriu/add_camera_consent_flag
Check for both possible camera consent suppression flags in user defaults
2 parents 59057ec + 8bca256 commit bbc0915

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

IdentityCore/src/webview/embeddedWebview/MSIDOAuth2EmbeddedWebviewController.m

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ @implementation MSIDOAuth2EmbeddedWebviewController
6565

6666
#if AD_BROKER
6767
NSString *const SSO_EXTENSION_USER_DEFAULTS_KEY = @"group.com.microsoft.azureauthenticator.sso";
68-
NSString *const CAMERA_CONSENT_PROMPT_SUPPRESS_KEY = @"Microsoft.Broker.Feature.sdm_suppress_camera_consent";
68+
NSString *const CAMERA_CONSENT_PROMPT_SUPPRESS_KEY = @"Microsoft.Broker.Feature.suppress_camera_consent";
69+
NSString *const SDM_CAMERA_CONSENT_PROMPT_SUPPRESS_KEY = @"Microsoft.Broker.Feature.sdm_suppress_camera_consent";
6970
#endif
7071

7172
- (id)initWithStartURL:(NSURL *)startURL
@@ -498,19 +499,31 @@ - (void) webView:(WKWebView *)webView
498499
type:(WKMediaCaptureType)type
499500
decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler API_AVAILABLE(ios(15.0), macos(12.0))
500501
{
501-
502-
NSUserDefaults *userDefaults = [[NSUserDefaults alloc] initWithSuiteName:SSO_EXTENSION_USER_DEFAULTS_KEY];
503-
id cameraConsentValue = [userDefaults objectForKey:CAMERA_CONSENT_PROMPT_SUPPRESS_KEY];
504-
505-
if (cameraConsentValue && ([cameraConsentValue isKindOfClass:NSNumber.class] || [cameraConsentValue isKindOfClass:NSString.class]))
502+
// Prompt suppression is only allowed for the camera
503+
if (type == WKMediaCaptureTypeCamera)
506504
{
507-
if ([cameraConsentValue boolValue] && type == WKMediaCaptureTypeCamera)
505+
NSUserDefaults *userDefaults = [[NSUserDefaults alloc] initWithSuiteName:SSO_EXTENSION_USER_DEFAULTS_KEY];
506+
id cameraConsentValue = [userDefaults objectForKey:CAMERA_CONSENT_PROMPT_SUPPRESS_KEY];
507+
id sdmCameraConsentValue = [userDefaults objectForKey:SDM_CAMERA_CONSENT_PROMPT_SUPPRESS_KEY];
508+
509+
if (cameraConsentValue && ([cameraConsentValue isKindOfClass:NSNumber.class] || [cameraConsentValue isKindOfClass:NSString.class]))
508510
{
509-
decisionHandler(WKPermissionDecisionGrant);
510-
return;
511+
if ([cameraConsentValue boolValue])
512+
{
513+
decisionHandler(WKPermissionDecisionGrant);
514+
return;
515+
}
516+
}
517+
else if (sdmCameraConsentValue && ([sdmCameraConsentValue isKindOfClass:NSNumber.class] || [sdmCameraConsentValue isKindOfClass:NSString.class]))
518+
{
519+
if ([sdmCameraConsentValue boolValue])
520+
{
521+
decisionHandler(WKPermissionDecisionGrant);
522+
return;
523+
}
511524
}
512525
}
513-
526+
514527
decisionHandler(WKPermissionDecisionPrompt);
515528
}
516529
#endif

0 commit comments

Comments
 (0)