Skip to content

Commit 0362b64

Browse files
authored
Merge pull request #1580 from AzureAD/josephpab/tenantFlighting
Added filter based flighting and lock some DUNA flags by tenant id
2 parents 7559787 + 879c9bb commit 0362b64

File tree

8 files changed

+483
-3
lines changed

8 files changed

+483
-3
lines changed

IdentityCore/IdentityCore.xcodeproj/project.pbxproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,12 @@
560560
2A59B4452D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A59B4422D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.m */; };
561561
2AADDAC72DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AADDAC62DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.m */; };
562562
2AADDAC82DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AADDAC52DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.h */; };
563+
4B6D22262E831B0B00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6D22252E831AEA00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h */; };
564+
4B6D222C2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6D222A2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.h */; };
565+
4B6D222D2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6D222B2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m */; };
566+
4B6D222E2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6D222B2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m */; };
567+
4BADFA5E2E85D7FC00E8C26F /* MSIDFlightManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BADFA5D2E85D7EC00E8C26F /* MSIDFlightManagerTests.swift */; };
568+
4BADFA5F2E85D7FC00E8C26F /* MSIDFlightManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BADFA5D2E85D7EC00E8C26F /* MSIDFlightManagerTests.swift */; };
563569
580E25402719FD10003D1795 /* MSIDPrtHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 580E253E2719FD10003D1795 /* MSIDPrtHeader.h */; };
564570
580E25412719FD10003D1795 /* MSIDPrtHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 580E253F2719FD10003D1795 /* MSIDPrtHeader.m */; };
565571
580E25422719FD10003D1795 /* MSIDPrtHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 580E253F2719FD10003D1795 /* MSIDPrtHeader.m */; };
@@ -2500,6 +2506,10 @@
25002506
2A59B4422D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDXpcInteractiveTokenRequestController.m; sourceTree = "<group>"; };
25012507
2AADDAC52DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDSSOXpcSilentTokenRequest.h; sourceTree = "<group>"; };
25022508
2AADDAC62DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDSSOXpcSilentTokenRequest.m; sourceTree = "<group>"; };
2509+
4B6D22252E831AEA00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDFlightManagerQueryKeyDelegate.h; sourceTree = "<group>"; };
2510+
4B6D222A2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDFlightManagerQueryKeyType.h; sourceTree = "<group>"; };
2511+
4B6D222B2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDFlightManagerQueryKeyType.m; sourceTree = "<group>"; };
2512+
4BADFA5D2E85D7EC00E8C26F /* MSIDFlightManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSIDFlightManagerTests.swift; sourceTree = "<group>"; };
25032513
51E364572863C0F300A97F82 /* MSIDTelemetryConditionalCompile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSIDTelemetryConditionalCompile.h; sourceTree = "<group>"; };
25042514
580E253E2719FD10003D1795 /* MSIDPrtHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDPrtHeader.h; sourceTree = "<group>"; };
25052515
580E253F2719FD10003D1795 /* MSIDPrtHeader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDPrtHeader.m; sourceTree = "<group>"; };
@@ -5735,6 +5745,9 @@
57355745
728209CB26FE951900B5F018 /* MSIDJwtAlgorithm.h */,
57365746
237F8F2C2D5166FE0095F164 /* MSIDFlightManager.h */,
57375747
237F8F2D2D5166FE0095F164 /* MSIDFlightManager.m */,
5748+
4B6D222A2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.h */,
5749+
4B6D222B2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m */,
5750+
4B6D22252E831AEA00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h */,
57385751
B48FC02E2D726A48007B80DB /* MSIDBrokerFlightProvider.h */,
57395752
B48FC0302D726A64007B80DB /* MSIDBrokerFlightProvider.m */,
57405753
);
@@ -5744,6 +5757,7 @@
57445757
D6DA89731FBA6A4E004C56C7 /* tests */ = {
57455758
isa = PBXGroup;
57465759
children = (
5760+
4BADFA5D2E85D7EC00E8C26F /* MSIDFlightManagerTests.swift */,
57475761
2318D7882E12B8E800A5A46E /* MSIDBrokerOperationBrowserNativeMessageMATSReportTests.m */,
57485762
72C764F82E09CFA400043AB1 /* MSIDBoundRefreshTokenTests.m */,
57495763
720B5B572DD58A6A00318FE5 /* MSIDJWECryptoTests.m */,
@@ -6328,6 +6342,7 @@
63286342
B2E2A923239221A000BA2EA3 /* MSIDBrokerOperationSignoutFromDeviceRequest.h in Headers */,
63296343
B2C708B3219A620B00D917B8 /* MSIDBrokerKeyProvider.h in Headers */,
63306344
23B39ABC209BD47D000AA905 /* MSIDB2CAuthorityResolver.h in Headers */,
6345+
4B6D22262E831B0B00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h in Headers */,
63316346
B443EFF62AD62BB900782168 /* MSIDPasskeyCredential.h in Headers */,
63326347
B286B99D2389DCA6007833AD /* MSIDSSOExtensionTokenRequestDelegate.h in Headers */,
63336348
B210F4551FDDFA7B005A8F76 /* MSIDBrokerResponse.h in Headers */,
@@ -6390,6 +6405,7 @@
63906405
74F04D4D246CB5B100094017 /* MSIDCurrentRequestTelemetrySerializedItem+Internal.h in Headers */,
63916406
238E19DD2086FE28004DF483 /* MSIDAADAuthorizationCodeRequest.h in Headers */,
63926407
B227037622A4C29800030ADC /* MSIDExtendedTokenCacheDataSource.h in Headers */,
6408+
4B6D222C2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.h in Headers */,
63936409
B251CC49204105A7005E0179 /* MSIDIdToken.h in Headers */,
63946410
B2F671EC2467AB4500649855 /* MSIDInteractiveRequestControlling.h in Headers */,
63956411
B443F0002AD6327700782168 /* MSIDBrokerOperationPasskeyCredentialRequest.h in Headers */,
@@ -7228,6 +7244,7 @@
72287244
B281B338226BBB1C009619AB /* MSIDOAuthRequestConfiguratorTests.m in Sources */,
72297245
A08D0A4824A8841400C9193D /* MSIDAuthenticationSchemeTest.m in Sources */,
72307246
B2808001204CB29900944D89 /* MSIDAADTokenResponseTests.m in Sources */,
7247+
4BADFA5F2E85D7FC00E8C26F /* MSIDFlightManagerTests.swift in Sources */,
72317248
60BE05F5239E580300CDA662 /* MSIDAccountMetadataCacheItemTests.m in Sources */,
72327249
B28BBD3F221267B200F51723 /* MSIDLegacyTokenResponseValidatorTests.m in Sources */,
72337250
E75DD02525D5E474007664A6 /* MSIDThrottlingServiceIntegrationTests.m in Sources */,
@@ -7630,6 +7647,7 @@
76307647
2318D7872E11763C00A5A46E /* MSIDBrokerOperationBrowserNativeMessageMATSReport.m in Sources */,
76317648
2A59B42E2D776F3400304FB1 /* MSIDXpcConfiguration.m in Sources */,
76327649
6057EE9120B5FDF8007976EB /* MSIDAADOAuthEmbeddedWebviewController.m in Sources */,
7650+
4B6D222D2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m in Sources */,
76337651
238E19DF2086FE28004DF483 /* MSIDTokenRequest.m in Sources */,
76347652
B2CDB5741FE2F4DF003A4B5C /* NSOrderedSet+MSIDExtensions.m in Sources */,
76357653
1E74094A24197E9200133EF7 /* NSDictionary+MSIDLogging.m in Sources */,
@@ -7845,6 +7863,7 @@
78457863
B2DD5BB2204789FB0084313F /* MSIDIdTokenTests.m in Sources */,
78467864
232C657721376755002A41FE /* MSIDDRSDiscoveryResponseSerializerTests.m in Sources */,
78477865
239FE69A236A594500D846AC /* MSIDJsonSerializableFactoryTests.m in Sources */,
7866+
4BADFA5E2E85D7FC00E8C26F /* MSIDFlightManagerTests.swift in Sources */,
78487867
580E254F271A1815003D1795 /* MSIDBrokerOperationGetSsoCookiesResponseTests.m in Sources */,
78497868
B279835B20D33A0A0051167F /* MSIDIdTokenClaimsTests.m in Sources */,
78507869
B86FA7D72383757E00E5195A /* MSIDMacLegacyCachePersistenceHandlerTests.m in Sources */,
@@ -8083,6 +8102,7 @@
80838102
8878C62E29DCA0E2002F5F4B /* MSIDCIAMTokenResponse.m in Sources */,
80848103
1E00D282248F27ED006E4BAE /* MSIDAuthScheme.m in Sources */,
80858104
600D19AE20964CC00004CD43 /* MSIDRegistrationInformation.m in Sources */,
8105+
4B6D222E2E8342C200546EC8 /* MSIDFlightManagerQueryKeyType.m in Sources */,
80868106
B2C07482246B70F70008D701 /* MSIDAssymetricKeyPair.m in Sources */,
80878107
B227035F22A367A000030ADC /* MSIDMaskedHashableLogParameter.m in Sources */,
80888108
B2C7B3B4213C681F009FFCC1 /* MSIDErrorConverter.m in Sources */,

IdentityCore/src/MSIDFlightManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525

2626
#import <Foundation/Foundation.h>
27+
#import "MSIDFlightManagerQueryKeyDelegate.h"
2728

2829
NS_ASSUME_NONNULL_BEGIN
2930

@@ -38,8 +39,11 @@ NS_ASSUME_NONNULL_BEGIN
3839
@interface MSIDFlightManager : NSObject <MSIDFlightManagerInterface>
3940

4041
@property (nonatomic, nullable) id<MSIDFlightManagerInterface> flightProvider;
42+
@property (nonatomic, nullable) id<MSIDFlightManagerQueryKeyDelegate> queryKeyFlightProvider;
4143

4244
+ (instancetype)sharedInstance;
45+
+ (instancetype)sharedInstanceByQueryKey:(NSString *)queryKey
46+
keyType:(MSIDFlightManagerQueryKeyType)keyType;
4347

4448
@end
4549

IdentityCore/src/MSIDFlightManager.m

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,56 @@ + (instancetype)sharedInstance
4545
return sharedInstance;
4646
}
4747

48+
+ (instancetype)sharedInstanceByQueryKey:(NSString *)queryKey
49+
keyType:(MSIDFlightManagerQueryKeyType)keyType
50+
{
51+
if ([NSString msidIsStringNilOrBlank:queryKey])
52+
{
53+
// Use shared flight manager if queryKey is nil or empty
54+
return [MSIDFlightManager sharedInstance];
55+
}
56+
57+
static NSMutableDictionary<NSString *, MSIDFlightManager *> *instancesByQueryKey = nil;
58+
static dispatch_once_t onceToken;
59+
static dispatch_queue_t synchronizationQueue;
60+
61+
dispatch_once(&onceToken, ^{
62+
instancesByQueryKey = [NSMutableDictionary new];
63+
synchronizationQueue = dispatch_queue_create("com.microsoft.msidflightmanager.querykey", DISPATCH_QUEUE_CONCURRENT);
64+
});
65+
66+
__block MSIDFlightManager *instance = nil;
67+
68+
// First, try to read the instance concurrently
69+
dispatch_sync(synchronizationQueue, ^{
70+
instance = instancesByQueryKey[queryKey];
71+
});
72+
73+
if (!instance)
74+
{
75+
// If not found, create and insert with a barrier write
76+
dispatch_barrier_sync(synchronizationQueue, ^{
77+
instance = instancesByQueryKey[queryKey];
78+
if (!instance)
79+
{
80+
instance = [[self.class alloc] initInternal];
81+
82+
id<MSIDFlightManagerInterface> flightProvider = [[MSIDFlightManager sharedInstance].queryKeyFlightProvider
83+
flightProviderForQueryKey:queryKey
84+
keyType:keyType];
85+
if (flightProvider)
86+
{
87+
instance.flightProvider = flightProvider;
88+
}
89+
90+
instancesByQueryKey[queryKey] = instance;
91+
}
92+
});
93+
}
94+
95+
return instance;
96+
}
97+
4898
- (instancetype)initInternal
4999
{
50100
self = [super init];
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
#import <Foundation/Foundation.h>
26+
#import "MSIDFlightManagerQueryKeyType.h"
27+
28+
@protocol MSIDFlightManagerInterface;
29+
30+
@protocol MSIDFlightManagerQueryKeyDelegate <NSObject>
31+
32+
- (nullable id<MSIDFlightManagerInterface>)flightProviderForQueryKey:(nonnull NSString *)queryKey
33+
keyType:(nonnull MSIDFlightManagerQueryKeyType)keyType;
34+
35+
@end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
#import <Foundation/Foundation.h>
26+
27+
NS_ASSUME_NONNULL_BEGIN
28+
29+
typedef NSString * MSIDFlightManagerQueryKeyType NS_STRING_ENUM;
30+
31+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeTenantId;
32+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeAppBundleId;
33+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeEcsRegion;
34+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUpn;
35+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUserId;
36+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeVersionNumber;
37+
38+
NS_ASSUME_NONNULL_END
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
#import "MSIDFlightManagerQueryKeyType.h"
26+
27+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeTenantId = @"tenantId";
28+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeAppBundleId = @"appBundleId";
29+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeEcsRegion = @"ecsRegion";
30+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUpn = @"upn";
31+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUserId = @"userId";
32+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeVersionNumber = @"version_number";

IdentityCore/src/oauth2/aad_base/MSIDAADWebviewFactory.m

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,42 @@
4141
#import "MSIDSwitchBrowserResponse.h"
4242
#import "MSIDSwitchBrowserResumeResponse.h"
4343
#import "MSIDFlightManager.h"
44+
#import "MSIDAccountIdentifier.h"
4445

4546
#if !EXCLUDE_FROM_MSALCPP
4647
#import "MSIDJITTroubleshootingResponse.h"
4748
#endif
4849

4950
@implementation MSIDAADWebviewFactory
5051

52+
#pragma mark - Private Methods
53+
54+
- (BOOL)isDUNASupportedForTenantId:(NSString *)tenantId
55+
{
56+
BOOL allowDUNAGlobal = [[MSIDFlightManager sharedInstance] boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA];
57+
58+
if (allowDUNAGlobal)
59+
{
60+
return YES;
61+
}
62+
63+
BOOL allowDUNAByTenant = NO;
64+
MSIDFlightManager *flightManager;
65+
66+
if (![NSString msidIsStringNilOrBlank:tenantId])
67+
{
68+
flightManager = [MSIDFlightManager sharedInstanceByQueryKey:tenantId keyType:MSIDFlightManagerQueryKeyTypeTenantId];
69+
}
70+
if (flightManager)
71+
{
72+
allowDUNAByTenant = [flightManager boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA];
73+
}
74+
75+
return allowDUNAByTenant;
76+
}
77+
78+
#pragma mark - Public Methods
79+
5180
- (NSMutableDictionary<NSString *, NSString *> *)authorizationParametersFromRequestParameters:(MSIDInteractiveTokenRequestParameters *)parameters
5281
pkce:(MSIDPkce *)pkce
5382
requestState:(NSString *)state
@@ -83,9 +112,10 @@ @implementation MSIDAADWebviewFactory
83112

84113
result[@"haschrome"] = @"1";
85114
[result addEntriesFromDictionary:MSIDDeviceId.deviceId];
86-
115+
87116
#if TARGET_OS_IPHONE
88-
if ([MSIDFlightManager.sharedInstance boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA])
117+
NSString *tenantId = parameters.accountIdentifier.utid;
118+
if ([self isDUNASupportedForTenantId:tenantId])
89119
{
90120
// Let server know that we support new cba flow
91121
result[MSID_BROWSER_RESPONSE_SWITCH_BROWSER] = @"1";
@@ -202,7 +232,9 @@ - (MSIDWebviewResponse *)oAuthResponseWithURL:(NSURL *)url
202232
error:nil];
203233
if (browserResponse) return browserResponse;
204234

205-
if ([MSIDFlightManager.sharedInstance boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA])
235+
NSString *tenantId = wpjResponse.clientInfo.utid;
236+
237+
if ([self isDUNASupportedForTenantId:tenantId])
206238
{
207239
MSIDSwitchBrowserResponse *switchBrowserResponse = [[MSIDSwitchBrowserResponse alloc] initWithURL:url
208240
redirectUri:endRedirectUri

0 commit comments

Comments
 (0)