Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions msal4j-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.2</version>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -96,7 +96,7 @@
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.5</version>
<version>1.17.5</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -114,7 +114,19 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
<version>4.13.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -126,7 +138,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
<version>2.22.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -169,7 +181,7 @@
<plugin>
<groupId>org.revapi</groupId>
<artifactId>revapi-maven-plugin</artifactId>
<version>0.15.0</version>
<version>0.15.1</version>
<configuration>
<analysisConfiguration>
<revapi.java>
Expand All @@ -183,7 +195,7 @@
<dependency>
<groupId>org.revapi</groupId>
<artifactId>revapi-java</artifactId>
<version>0.28.1</version>
<version>0.28.4</version>
</dependency>
</dependencies>
<executions>
Expand All @@ -199,7 +211,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
Expand All @@ -213,7 +225,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<version>3.5.6</version>
<configuration>
<argLine>@{argLine} -noverify</argLine>
<skipTests>${skip.unit.tests}</skipTests>
Expand All @@ -222,7 +234,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<version>3.12.0</version>
<configuration>
<sourcepath>src/main/java</sourcepath>
</configuration>
Expand All @@ -238,7 +250,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.4.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -251,12 +263,12 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.11</version>
<version>4.2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.15.0</version>
<configuration>
<source>8</source>
<target>8</target>
Expand All @@ -265,7 +277,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<version>3.6.0</version>
<executions>
<execution>
<id>add-test-source</id>
Expand All @@ -284,7 +296,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.6</version>
<executions>
<execution>
<goals>
Expand All @@ -303,7 +315,7 @@
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>5.2.0</version>
<version>6.4.0</version>
<executions>
<execution>
<goals>
Expand All @@ -315,7 +327,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<version>0.8.13</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -360,7 +372,7 @@
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<version>3.11.0</version>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ void acquireTokenSilent_ConfidentialClient_acquireTokenSilent() throws Exception
.build())
.get();

assertNotNull(result);
assertNotNull(result.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(result);

String cachedAt = result.accessToken();

Expand All @@ -133,8 +132,7 @@ void acquireTokenSilent_ConfidentialClient_acquireTokenSilentDifferentScopeThrow
.build())
.get();

assertNotNull(result);
assertNotNull(result.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(result);

//Acquiring token for different scope, expect exception to be thrown
assertThrows(ExecutionException.class, () -> cca.acquireTokenSilently(SilentParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ void acquireTokenClientCredentials_Certificate_CiamCud() throws Exception {
.build())
.get();

assertNotNull(result);
assertNotNull(result.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(result);
}

@Test
Expand Down Expand Up @@ -117,8 +116,7 @@ void acquireTokenClientCredentials_DefaultCacheLookup() throws Exception {
.build())
.get();

assertNotNull(result1);
assertNotNull(result1.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(result1);

IAuthenticationResult result2 = cca.acquireToken(ClientCredentialParameters
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
Expand All @@ -133,8 +131,7 @@ void acquireTokenClientCredentials_DefaultCacheLookup() throws Exception {
.build())
.get();

assertNotNull(result3);
assertNotNull(result3.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(result3);
assertNotEquals(result2.accessToken(), result3.accessToken());
}

Expand Down Expand Up @@ -164,8 +161,7 @@ private void assertAcquireTokenCommon(String clientId, IClientCredential credent
.build())
.get();

assertNotNull(result);
assertNotNull(result.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(result);
}

private void assertAcquireTokenCommon_withParameters(AppConfig app, IClientCredential credential, IClientCredential credentialParam) throws Exception {
Expand All @@ -180,8 +176,7 @@ private void assertAcquireTokenCommon_withParameters(AppConfig app, IClientCrede
.build())
.get();

assertNotNull(result);
assertNotNull(result.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(result);
}

private void assertAcquireTokenCommon_withRegion(AppConfig app, IClientCredential credential, String region, String regionalAuthority) throws Exception {
Expand All @@ -202,8 +197,7 @@ private void assertAcquireTokenCommon_withRegion(AppConfig app, IClientCredentia
.build())
.get();

assertNotNull(resultNoRegion);
assertNotNull(resultNoRegion.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(resultNoRegion);
assertEquals(TestConstants.MICROSOFT_AUTHORITY_BASIC_HOST, resultNoRegion.environment());

//Ensure regional tokens are properly cached and retrievable
Expand All @@ -212,17 +206,15 @@ private void assertAcquireTokenCommon_withRegion(AppConfig app, IClientCredentia
.build())
.get();

assertNotNull(resultRegion);
assertNotNull(resultRegion.accessToken());
assertEquals(resultRegion.environment(), regionalAuthority);
IntegrationTestHelper.assertAccessTokenNotNull(resultRegion);
assertEquals(regionalAuthority, resultRegion.environment());

IAuthenticationResult resultRegionCached = ccaRegion.acquireToken(ClientCredentialParameters
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
.build())
.get();

assertNotNull(resultRegionCached);
assertNotNull(resultRegionCached.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(resultRegionCached);
assertEquals(resultRegionCached.accessToken(), resultRegion.accessToken());

//Tokens retrieved from regional endpoints should be interchangeable with non-regional, and vice-versa
Expand All @@ -233,8 +225,7 @@ private void assertAcquireTokenCommon_withRegion(AppConfig app, IClientCredentia
.build())
.get();

assertNotNull(resultNoRegion);
assertNotNull(resultNoRegion.accessToken());
IntegrationTestHelper.assertAccessTokenNotNull(resultNoRegion);
assertEquals(resultNoRegion.accessToken(), resultRegion.accessToken());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void singleAccountInCache_RemoveAccountTest() throws Exception {
build();

// Check that cache is empty
assertEquals(pca.getAccounts().join().size(), 0);
assertEquals(0, pca.getAccounts().join().size());

Map<String, String> extraQueryParameters = new HashMap<>();
extraQueryParameters.put("test", "test");
Expand All @@ -43,12 +43,12 @@ void singleAccountInCache_RemoveAccountTest() throws Exception {
.get();

// Check that cache contains one account
assertEquals(pca.getAccounts().join().size(), 1);
assertEquals(1, pca.getAccounts().join().size());

pca.removeAccount(pca.getAccounts().join().iterator().next()).join();

// Check that account has been removed
assertEquals(pca.getAccounts().join().size(), 0);
assertEquals(0, pca.getAccounts().join().size());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ private SeleniumExtensions() {

public static WebDriver createDefaultWebDriver() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--headless=new");
options.addArguments("--incognito");

return new ChromeDriver(options);
}

public static WebElement waitForElementToBeVisibleAndEnabled(WebDriver driver, By by, Duration timeout) {
WebDriverWait wait = new WebDriverWait(driver, timeout.getSeconds());
WebDriverWait wait = new WebDriverWait(driver, timeout);
return wait.until(ExpectedConditions.elementToBeClickable(by));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ADFSLoginPage {

public ADFSLoginPage(WebDriver driver) {
this.driver = driver;
this.wait = new WebDriverWait(driver, DEFAULT_TIMEOUT.getSeconds());
this.wait = new WebDriverWait(driver, DEFAULT_TIMEOUT);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AzureADLoginPage {

public AzureADLoginPage(WebDriver driver) {
this.driver = driver;
this.wait = new WebDriverWait(driver, DEFAULT_TIMEOUT.getSeconds());
this.wait = new WebDriverWait(driver, DEFAULT_TIMEOUT);
}

/**
Expand Down Expand Up @@ -103,7 +103,7 @@ public AzureADLoginPage clickSubmit() {
*/
public boolean isAuthenticationComplete() {
try {
WebDriverWait shortWait = new WebDriverWait(driver, SHORT_TIMEOUT.getSeconds());
WebDriverWait shortWait = new WebDriverWait(driver, SHORT_TIMEOUT);
shortWait.until(ExpectedConditions.textToBePresentInElementLocated(
AUTH_COMPLETE_BODY, AUTH_COMPLETE_TEXT));
LOG.info("Authentication complete page detected");
Expand Down Expand Up @@ -150,7 +150,7 @@ private void handleOptionalPrompts() {
private void handleAreYouTryingToSignInPrompt() {
try {
LOG.info("Checking for 'Are you trying to sign in' prompt");
WebDriverWait shortWait = new WebDriverWait(driver, SHORT_TIMEOUT.getSeconds());
WebDriverWait shortWait = new WebDriverWait(driver, SHORT_TIMEOUT);
shortWait.until(ExpectedConditions.elementToBeClickable(ARE_YOU_TRYING_TO_SIGN_IN_BUTTON))
.click();
LOG.info("Clicked Continue on 'Are you trying to sign in' prompt");
Expand All @@ -165,7 +165,7 @@ private void handleAreYouTryingToSignInPrompt() {
private void handleStaySignedInPrompt() {
try {
LOG.info("Checking for 'Stay signed in' prompt");
WebDriverWait shortWait = new WebDriverWait(driver, SHORT_TIMEOUT.getSeconds());
WebDriverWait shortWait = new WebDriverWait(driver, SHORT_TIMEOUT);
shortWait.until(ExpectedConditions.elementToBeClickable(STAY_SIGNED_IN_NO_BUTTON))
.click();
LOG.info("Clicked No on 'Stay signed in' prompt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class B2CLocalLoginPage {

public B2CLocalLoginPage(WebDriver driver) {
this.driver = driver;
this.wait = new WebDriverWait(driver, DEFAULT_TIMEOUT.getSeconds());
this.wait = new WebDriverWait(driver, DEFAULT_TIMEOUT);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ void aadInstanceDiscoveryTest_AutoDetectRegion_NoRegionDetected() throws Excepti
}

void assertValidResponse(InstanceDiscoveryMetadataEntry entry) {
assertEquals(entry.preferredNetwork(), "login.microsoftonline.com");
assertEquals(entry.preferredCache(), "login.windows.net");
assertEquals(entry.aliases().size(), 4);
assertEquals("login.microsoftonline.com", entry.preferredNetwork());
assertEquals("login.windows.net", entry.preferredCache());
assertEquals(4, entry.aliases().size());
assertTrue(entry.aliases().contains("login.microsoftonline.com"));
assertTrue(entry.aliases().contains("login.windows.net"));
assertTrue(entry.aliases().contains("login.microsoft.com"));
Expand Down
Loading