diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b74c6a309..07a51b0c07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ -## [0.2.1] - 2018-09-27 +## [0.2.1] - 2018-10-29 ### Added - Fix clang analyzer issues. - WKWebView drops network connection if device got locked on iOS 12. It is by design and not configurable. +- Improved schema compatibility with other MSAL/ADAL SDKs +- Optimize silent requests ## [0.2.0] - 2018-09-18 ### Added diff --git a/MSAL/test/automation/tests/interactive/MSALGuestUserTests.m b/MSAL/test/automation/tests/interactive/MSALGuestUserTests.m index 5003240584..5bbea389da 100644 --- a/MSAL/test/automation/tests/interactive/MSALGuestUserTests.m +++ b/MSAL/test/automation/tests/interactive/MSALGuestUserTests.m @@ -54,7 +54,7 @@ - (void)testInteractiveAndSilentAADLogin_withNonConvergedApp_withPromptAlways_no request.authority = [NSString stringWithFormat:@"https://login.microsoftonline.com/%@", self.primaryAccount.targetTenantId]; // 1. Run interactive in the guest tenant - NSString *homeAccountId = [self runSharedADFSInteractiveLoginWithRequest:request closeResultView:NO]; + NSString *homeAccountId = [self runSharedGuestInteractiveLoginWithRequest:request closeResultView:NO]; NSString *resultTenantId = [self resultDictionary][@"tenantId"]; XCTAssertEqualObjects(resultTenantId, self.primaryAccount.targetTenantId); XCTAssertNotNil(homeAccountId); @@ -86,7 +86,7 @@ - (void)testInteractiveAndSilentAADLogin_withNonConvergedApp_withPromptAlways_no homeRequest.authority = [NSString stringWithFormat:@"https://login.microsoftonline.com/%@", self.primaryAccount.homeTenantId]; // 1. Run interactive in the home tenant - NSString *homeAccountId = [self runSharedADFSInteractiveLoginWithRequest:homeRequest closeResultView:NO]; + NSString *homeAccountId = [self runSharedGuestInteractiveLoginWithRequest:homeRequest closeResultView:NO]; NSString *resultTenantId = [self resultDictionary][@"tenantId"]; XCTAssertEqualObjects(resultTenantId, self.primaryAccount.homeTenantId); XCTAssertNotNil(homeAccountId); @@ -124,7 +124,7 @@ - (void)testInteractiveAndSilentAADLogin_withConvergedApp_withPromptAlways_noLog guestRequest.authority = [NSString stringWithFormat:@"https://login.microsoftonline.com/%@", self.primaryAccount.targetTenantId]; // 1. Run interactive in the guest tenant - NSString *homeAccountId = [self runSharedADFSInteractiveLoginWithRequest:guestRequest closeResultView:NO]; + NSString *homeAccountId = [self runSharedGuestInteractiveLoginWithRequest:guestRequest closeResultView:NO]; NSString *resultTenantId = [self resultDictionary][@"tenantId"]; XCTAssertEqualObjects(resultTenantId, self.primaryAccount.targetTenantId); XCTAssertNotNil(homeAccountId); @@ -142,7 +142,7 @@ - (void)testInteractiveAndSilentAADLogin_withConvergedApp_withPromptAlways_noLog // TODO: lab doesn't return correct home object ID at the moment, need to follow up on that! homeRequest.testAccount.homeObjectId = [[homeAccountId componentsSeparatedByString:@"."] firstObject]; homeRequest.testAccount.targetTenantId = self.primaryAccount.homeTenantId; - [self runSharedADFSInteractiveLoginWithRequest:homeRequest closeResultView:YES]; + [self runSharedGuestInteractiveLoginWithRequest:homeRequest closeResultView:YES]; // 3. Run silent for the guest tenant guestRequest.accountIdentifier = homeAccountId; @@ -159,4 +159,48 @@ - (void)testInteractiveAndSilentAADLogin_withConvergedApp_withPromptAlways_noLog [self runSharedSilentAADLoginWithTestRequest:homeRequest]; } +- (NSString *)runSharedGuestInteractiveLoginWithRequest:(MSALTestRequest *)request + closeResultView:(BOOL)closeResultView +{ + // 1. Do interactive login + NSDictionary *config = [self configWithTestRequest:request]; + [self acquireToken:config]; + + [self acceptAuthSessionDialogIfNecessary:request]; + + if (!request.loginHint) + { + [self aadEnterEmail]; + } + + [self enterGuestUsername]; + [self enterGuestPassword]; + [self acceptMSSTSConsentIfNecessary:@"Accept" embeddedWebView:request.usesEmbeddedWebView]; + + NSString *homeAccountId = [self runSharedResultAssertionWithTestRequest:request guestTenantScenario:NO]; + + if (closeResultView) + { + [self closeResultView]; + } + + return homeAccountId; +} + +- (void)enterGuestUsername +{ + XCUIElement *passwordTextField = [self.testApp.textFields elementBoundByIndex:0]; + [self waitForElement:passwordTextField]; + [self tapElementAndWaitForKeyboardToAppear:passwordTextField]; + [passwordTextField typeText:[NSString stringWithFormat:@"%@\n", self.primaryAccount.username]]; +} + +- (void)enterGuestPassword +{ + XCUIElement *passwordTextField = [self.testApp.secureTextFields elementBoundByIndex:0]; + [self waitForElement:passwordTextField]; + [self tapElementAndWaitForKeyboardToAppear:passwordTextField]; + [passwordTextField typeText:[NSString stringWithFormat:@"%@\n", self.primaryAccount.password]]; +} + @end diff --git a/MSAL/test/automation/tests/interactive/MSALShibUITests.m b/MSAL/test/automation/tests/interactive/MSALShibUITests.m index 0f02edab7d..e1bb84b15a 100644 --- a/MSAL/test/automation/tests/interactive/MSALShibUITests.m +++ b/MSAL/test/automation/tests/interactive/MSALShibUITests.m @@ -111,9 +111,6 @@ - (void)testInteractiveShibLogin_withConvergedApp_withPromptAlways_withLoginHint // 1. Run interactive NSString *homeAccountId = [self runSharedShibbolethInteractiveLoginWithRequest:request]; XCTAssertNotNil(homeAccountId); - - // 2. Run UI appears step - [self runSharedAuthUIAppearsStepWithTestRequest:request]; } - (void)testInteractiveShibLogin_withConvergedApp_withPromptAlways_withLoginHint_andPassedInWebView