|
49 | 49 |
|
50 | 50 | @implementation MSIDAADWebviewFactory |
51 | 51 |
|
| 52 | +#pragma mark - Private Methods |
| 53 | + |
| 54 | +- (BOOL)isDUNASupportedForTenantId:(NSString *)tenantId |
| 55 | +{ |
| 56 | + BOOL allowDUNAByTenant = NO; |
| 57 | + BOOL allowDUNAGlobal = NO; |
| 58 | + MSIDFlightManager* flightManager; |
| 59 | + |
| 60 | + if (![NSString msidIsStringNilOrBlank:tenantId]) |
| 61 | + { |
| 62 | + flightManager = [MSIDFlightManager sharedInstanceByQueryKey:tenantId keyType:MSIDFlightManagerQueryKeyTypeTenantId]; |
| 63 | + } |
| 64 | + if (flightManager) |
| 65 | + { |
| 66 | + allowDUNAByTenant = [flightManager boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]; |
| 67 | + } |
| 68 | + allowDUNAGlobal = [[MSIDFlightManager sharedInstance] boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]; |
| 69 | + |
| 70 | + return allowDUNAGlobal || allowDUNAByTenant; |
| 71 | +} |
| 72 | + |
| 73 | +#pragma mark - Public Methods |
| 74 | + |
52 | 75 | - (NSMutableDictionary<NSString *, NSString *> *)authorizationParametersFromRequestParameters:(MSIDInteractiveTokenRequestParameters *)parameters |
53 | 76 | pkce:(MSIDPkce *)pkce |
54 | 77 | requestState:(NSString *)state |
@@ -86,22 +109,9 @@ @implementation MSIDAADWebviewFactory |
86 | 109 | [result addEntriesFromDictionary:MSIDDeviceId.deviceId]; |
87 | 110 |
|
88 | 111 | NSString* tenantId = parameters.accountIdentifier.utid; |
89 | | - BOOL allowDUNAByTenant = NO; |
90 | | - BOOL allowDUNAGlobal = NO; |
91 | | - MSIDFlightManager* flightManager; |
92 | | - |
93 | | - if (![NSString msidIsStringNilOrBlank:tenantId]) |
94 | | - { |
95 | | - flightManager = [MSIDFlightManager sharedInstanceByQueryKey:tenantId keyType:MSIDFlightManagerQueryKeyTypeTenantId]; |
96 | | - } |
97 | | - if (flightManager) |
98 | | - { |
99 | | - allowDUNAByTenant = [flightManager boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]; |
100 | | - } |
101 | | - allowDUNAGlobal = [[MSIDFlightManager sharedInstance] boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]; |
102 | 112 |
|
103 | 113 | #if TARGET_OS_IPHONE |
104 | | - if (allowDUNAGlobal || allowDUNAByTenant) |
| 114 | + if ([self isDUNASupportedForTenantId:tenantId]) |
105 | 115 | { |
106 | 116 | // Let server know that we support new cba flow |
107 | 117 | result[MSID_BROWSER_RESPONSE_SWITCH_BROWSER] = @"1"; |
@@ -219,21 +229,8 @@ - (MSIDWebviewResponse *)oAuthResponseWithURL:(NSURL *)url |
219 | 229 | if (browserResponse) return browserResponse; |
220 | 230 |
|
221 | 231 | NSString* tenantId = wpjResponse.clientInfo.utid; |
222 | | - BOOL allowDUNAByTenant = NO; |
223 | | - BOOL allowDUNAGlobal = NO; |
224 | | - MSIDFlightManager* flightManager; |
225 | | - |
226 | | - if (![NSString msidIsStringNilOrBlank:tenantId]) |
227 | | - { |
228 | | - flightManager = [MSIDFlightManager sharedInstanceByQueryKey:tenantId keyType:MSIDFlightManagerQueryKeyTypeTenantId]; |
229 | | - } |
230 | | - if (flightManager) |
231 | | - { |
232 | | - allowDUNAByTenant = [flightManager boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]; |
233 | | - } |
234 | | - allowDUNAGlobal = [[MSIDFlightManager sharedInstance] boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]; |
235 | 232 |
|
236 | | - if (allowDUNAGlobal || allowDUNAByTenant) |
| 233 | + if ([self isDUNASupportedForTenantId:tenantId]) |
237 | 234 | { |
238 | 235 | MSIDSwitchBrowserResponse *switchBrowserResponse = [[MSIDSwitchBrowserResponse alloc] initWithURL:url |
239 | 236 | redirectUri:endRedirectUri |
|
0 commit comments