Skip to content

Commit d27b361

Browse files
authored
Merge pull request #1536 from AzureAD/hotfix/4.0.8
Release ADAL 4.0.8
2 parents fa10566 + b96eb4a commit d27b361

File tree

9 files changed

+20
-14
lines changed

9 files changed

+20
-14
lines changed

ADAL.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "ADAL"
33
s.module_name = "ADAL"
4-
s.version = "4.0.7"
4+
s.version = "4.0.8"
55
s.summary = "The ADAL SDK for iOS gives you the ability to add Azure Identity authentication to your application"
66

77
s.description = <<-DESC

ADAL/resources/ios/Framework/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>4.0.7</string>
18+
<string>4.0.8</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

ADAL/src/ADAL_Internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#define ADAL_VER_HIGH 4
3030
#define ADAL_VER_LOW 0
31-
#define ADAL_VER_PATCH 7
31+
#define ADAL_VER_PATCH 8
3232

3333
#define STR_HELPER(x) #x
3434
#define STR(x) STR_HELPER(x)

ADAL/src/validation/ADAuthorityValidation.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ - (void)checkAuthority:(ADRequestParameters*)requestParams
185185
{
186186
// Validate AAD authority
187187
[self validateAADAuthority:authorityURL
188+
shouldValidateAuthority:validateAuthority
188189
requestParams:requestParams
189190
completionBlock:^(BOOL validated, ADAuthenticationError *error)
190191
{
@@ -203,6 +204,7 @@ - (void)checkAuthority:(ADRequestParameters*)requestParams
203204
// If the authority is known, the server will set the "tenant_discovery_endpoint" parameter in the response.
204205
// The method should be executed on a thread that is guarranteed to exist upon completion, e.g. the UI thread.
205206
- (void)validateAADAuthority:(NSURL *)authority
207+
shouldValidateAuthority:(BOOL)shouldValidateAuthority
206208
requestParams:(ADRequestParameters *)requestParams
207209
completionBlock:(ADAuthorityValidationCallback)completionBlock
208210
{
@@ -225,6 +227,7 @@ - (void)validateAADAuthority:(NSURL *)authority
225227
__block dispatch_semaphore_t dsem = dispatch_semaphore_create(0);
226228

227229
[self requestAADValidation:authority
230+
shouldValidateAuthority:shouldValidateAuthority
228231
requestParams:requestParams
229232
completionBlock:^(BOOL validated, ADAuthenticationError *error)
230233
{
@@ -255,6 +258,7 @@ - (void)validateAADAuthority:(NSURL *)authority
255258
}
256259

257260
- (void)requestAADValidation:(NSURL *)authorityUrl
261+
shouldValidateAuthority:(BOOL)shouldValidateAuthority
258262
requestParams:(ADRequestParameters *)requestParams
259263
completionBlock:(ADAuthorityValidationCallback)completionBlock
260264
{
@@ -278,7 +282,7 @@ - (void)requestAADValidation:(NSURL *)authorityUrl
278282

279283
NSString *trustedHost = ADTrustedAuthorityWorldWide;
280284

281-
if ([ADAuthorityUtils isKnownHost:authority.url])
285+
if ([ADAuthorityUtils isKnownHost:authority.url] || !shouldValidateAuthority)
282286
{
283287
trustedHost = authority.environment;
284288
}

ADAL/tests/ADTestAuthorityValidationResponse.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030
+ (ADTestURLResponse*)validAuthority:(NSString *)authority;
3131
+ (ADTestURLResponse *)validAuthority:(NSString *)authority
3232
withMetadata:(NSArray *)metadata;
33+
3334
+ (ADTestURLResponse *)validAuthority:(NSString *)authority
3435
trustedHost:(NSString *)trustedHost
3536
withMetadata:(NSArray *)metadata;
3637

37-
+ (ADTestURLResponse*)invalidAuthority:(NSString *)authority;
38+
+ (ADTestURLResponse *)invalidAuthority:(NSString *)authority validationEnabled:(BOOL)validationEnabled;
3839
+ (ADTestURLResponse*)invalidAuthority:(NSString *)authority
3940
trustedHost:(NSString *)trustedHost;
4041

ADAL/tests/ADTestAuthorityValidationResponse.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ + (ADTestURLResponse *)validAuthority:(NSString *)authority
6363
return response;
6464
}
6565

66-
+ (ADTestURLResponse *)invalidAuthority:(NSString *)authority
66+
+ (ADTestURLResponse *)invalidAuthority:(NSString *)authority validationEnabled:(BOOL)validationEnabled
6767
{
68-
return [self invalidAuthority:authority trustedHost:DEFAULT_TRUSTED_HOST];
68+
NSString *trustedHost = validationEnabled ? DEFAULT_TRUSTED_HOST : [NSURL URLWithString:authority].host;
69+
return [self invalidAuthority:authority trustedHost:trustedHost];
6970
}
7071

7172
+ (ADTestURLResponse*)invalidAuthority:(NSString *)authority

ADAL/tests/app/resources/ios/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>4.0.7</string>
18+
<string>4.0.8</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleURLTypes</key>

ADAL/tests/integration/AADAuthorityValidationIntegrationTests.m

+5-5
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ - (void)testCheckAuthority_whenAuthorityInvalid_shouldReturnError
162162
requestParams.authority = authority;
163163
requestParams.correlationId = [NSUUID UUID];
164164

165-
[ADTestURLSession addResponse:[ADTestAuthorityValidationResponse invalidAuthority:authority]];
165+
[ADTestURLSession addResponse:[ADTestAuthorityValidationResponse invalidAuthority:authority validationEnabled:YES]];
166166

167167
XCTestExpectation* expectation = [self expectationWithDescription:@"Validate invalid authority."];
168168
[authorityValidation checkAuthority:requestParams
@@ -194,7 +194,7 @@ - (void)testCheckAuthority_whenAuthorityInvalidAndNoValidation_shouldReturnNoErr
194194
requestParams.authority = authority;
195195
requestParams.correlationId = [NSUUID UUID];
196196

197-
[ADTestURLSession addResponse:[ADTestAuthorityValidationResponse invalidAuthority:authority]];
197+
[ADTestURLSession addResponse:[ADTestAuthorityValidationResponse invalidAuthority:authority validationEnabled:NO]];
198198

199199
XCTestExpectation* expectation = [self expectationWithDescription:@"Validate invalid authority."];
200200
[authorityValidation checkAuthority:requestParams
@@ -228,7 +228,7 @@ - (void)testAcquireToken_whenAuthorityInvalid_shouldReturnError
228228
XCTAssertNotNil(context);
229229
XCTAssertNil(error);
230230

231-
[ADTestURLSession addResponse:[ADTestAuthorityValidationResponse invalidAuthority:authority]];
231+
[ADTestURLSession addResponse:[ADTestAuthorityValidationResponse invalidAuthority:authority validationEnabled:YES]];
232232

233233
XCTestExpectation* expectation = [self expectationWithDescription:@"acquireTokenWithResource: with invalid authority."];
234234
[context acquireTokenWithResource:TEST_RESOURCE
@@ -284,7 +284,7 @@ - (void)testAcquireToken_whenAuthorityInvalidWithAuthorityValidationOff_shouldGe
284284
newAccessToken:updatedAT
285285
newIDToken:[self adDefaultIDToken]
286286
additionalFields:@{ @"foci" : @"1" }];
287-
[ADTestURLSession addResponses:@[[ADTestAuthorityValidationResponse invalidAuthority:authority],
287+
[ADTestURLSession addResponses:@[[ADTestAuthorityValidationResponse invalidAuthority:authority validationEnabled:NO],
288288
tokenResponse]];
289289

290290
__block XCTestExpectation *expectation = [self expectationWithDescription:@"acquire token"];
@@ -510,7 +510,7 @@ - (void)testAcquireTokenSilent_whenDifferentPreferredNetworkValidateOff_shouldUs
510510
NSArray *metadata = @[ @{ @"preferred_network" : @"login.contoso.net",
511511
@"preferred_cache" : @"login.contoso.com",
512512
@"aliases" : @[ @"login.contoso.net", @"login.contoso.com"] } ];
513-
ADTestURLResponse *validationResponse = [ADTestAuthorityValidationResponse validAuthority:authority withMetadata:metadata];
513+
ADTestURLResponse *validationResponse = [ADTestAuthorityValidationResponse validAuthority:authority trustedHost:@"login.contoso.com" withMetadata:metadata];
514514
ADTestURLResponse *tokenResponse = [self adResponseRefreshToken:TEST_REFRESH_TOKEN
515515
authority:preferredAuthority
516516
resource:TEST_RESOURCE

0 commit comments

Comments
 (0)