|
38 | 38 | #import "MSIDSignoutWebRequestConfiguration.h"
|
39 | 39 | #import "NSURL+MSIDAADUtils.h"
|
40 | 40 | #import "MSIDInteractiveTokenRequestParameters.h"
|
| 41 | +#import "MSIDSwitchBrowserResponse.h" |
| 42 | +#import "MSIDSwitchBrowserResumeResponse.h" |
| 43 | +#import "MSIDFlightManager.h" |
41 | 44 |
|
42 | 45 | #if !EXCLUDE_FROM_MSALCPP
|
43 | 46 | #import "MSIDJITTroubleshootingResponse.h"
|
@@ -73,14 +76,22 @@ @implementation MSIDAADWebviewFactory
|
73 | 76 | {
|
74 | 77 | [result addEntriesFromDictionary:
|
75 | 78 | @{
|
76 |
| - MSID_OAUTH2_CORRELATION_ID_REQUEST : @"true", |
77 |
| - MSID_OAUTH2_CORRELATION_ID_REQUEST_VALUE : [parameters.correlationId UUIDString] |
78 |
| - }]; |
| 79 | + MSID_OAUTH2_CORRELATION_ID_REQUEST : @"true", |
| 80 | + MSID_OAUTH2_CORRELATION_ID_REQUEST_VALUE : [parameters.correlationId UUIDString] |
| 81 | + }]; |
79 | 82 | }
|
80 | 83 |
|
81 | 84 | result[@"haschrome"] = @"1";
|
82 | 85 | [result addEntriesFromDictionary:MSIDDeviceId.deviceId];
|
83 | 86 |
|
| 87 | +#if TARGET_OS_IPHONE |
| 88 | + if ([MSIDFlightManager.sharedInstance boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]) |
| 89 | + { |
| 90 | + // Let server know that we support new cba flow |
| 91 | + result[MSID_BROWSER_RESPONSE_SWITCH_BROWSER] = @"1"; |
| 92 | + } |
| 93 | +#endif |
| 94 | + |
84 | 95 | return result;
|
85 | 96 | }
|
86 | 97 |
|
@@ -139,6 +150,7 @@ @implementation MSIDAADWebviewFactory
|
139 | 150 | - (MSIDWebviewResponse *)oAuthResponseWithURL:(NSURL *)url
|
140 | 151 | requestState:(NSString *)requestState
|
141 | 152 | ignoreInvalidState:(BOOL)ignoreInvalidState
|
| 153 | + endRedirectUri:(NSString *)endRedirectUri |
142 | 154 | context:(id<MSIDRequestContext>)context
|
143 | 155 | error:(NSError *__autoreleasing*)error
|
144 | 156 | {
|
@@ -190,7 +202,22 @@ - (MSIDWebviewResponse *)oAuthResponseWithURL:(NSURL *)url
|
190 | 202 | error:nil];
|
191 | 203 | if (browserResponse) return browserResponse;
|
192 | 204 |
|
193 |
| - // Try to create AAD Auth response |
| 205 | + if ([MSIDFlightManager.sharedInstance boolForKey:MSID_FLIGHT_SUPPORT_DUNA_CBA]) |
| 206 | + { |
| 207 | + MSIDSwitchBrowserResponse *switchBrowserResponse = [[MSIDSwitchBrowserResponse alloc] initWithURL:url |
| 208 | + redirectUri:endRedirectUri |
| 209 | + context:context |
| 210 | + error:nil]; |
| 211 | + if (switchBrowserResponse) return switchBrowserResponse; |
| 212 | + |
| 213 | + MSIDSwitchBrowserResumeResponse *switchBrowserResumeResponse = [[MSIDSwitchBrowserResumeResponse alloc] initWithURL:url |
| 214 | + redirectUri:endRedirectUri |
| 215 | + context:context |
| 216 | + error:nil]; |
| 217 | + if (switchBrowserResumeResponse) return switchBrowserResumeResponse; |
| 218 | + } |
| 219 | + |
| 220 | + // Try to create AAD Auth response or Error response (all other reponses don't handle errors). |
194 | 221 | MSIDWebAADAuthCodeResponse *response = [[MSIDWebAADAuthCodeResponse alloc] initWithURL:url
|
195 | 222 | requestState:requestState
|
196 | 223 | ignoreInvalidState:ignoreInvalidState
|
|
0 commit comments