Skip to content

Commit b822d43

Browse files
committed
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentication-library-for-java into avdunn/cloudshell-request-fix
2 parents 54e9bb0 + c1ca9ff commit b822d43

39 files changed

+375
-199
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Quick links:
1616
The library supports the following Java environments:
1717
- Java 8 (or higher)
1818

19-
Current version - 1.15.0
19+
Current version - 1.16.1
2020

2121
You can find the changes for each version in the [change log](https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/main/msal4j-sdk/changelog.txt).
2222

@@ -28,13 +28,13 @@ Find [the latest package in the Maven repository](https://mvnrepository.com/arti
2828
<dependency>
2929
<groupId>com.microsoft.azure</groupId>
3030
<artifactId>msal4j</artifactId>
31-
<version>1.15.0</version>
31+
<version>1.16.1</version>
3232
</dependency>
3333
```
3434
### Gradle
3535

3636
```gradle
37-
implementation group: 'com.microsoft.azure', name: 'com.microsoft.aad.msal4j', version: '1.15.0'
37+
implementation group: 'com.microsoft.azure', name: 'com.microsoft.aad.msal4j', version: '1.16.1'
3838
```
3939

4040
## Usage

changelog.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
Version 1.16.1
2+
=============
3+
- Add missing refreshOn metadata (#838)
4+
5+
Version 1.16.0
6+
=============
7+
- Fix breaking API changes introduced in v1.15.0 (#828)
8+
- Expose refreshOn parameter in AuthenticationResultMetadata (#829)
9+
10+
Version 1.15.1
11+
=============
12+
- Fix to correctly use custom SSLSocketFactory (#821)
13+
- Add public API to determine the Managed Identity environment (#823)
14+
115
Version 1.15.0
216
=============
317
- GA support for Azure managed identity scenarios

msal4j-sdk/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Quick links:
1616
The library supports the following Java environments:
1717
- Java 8 (or higher)
1818

19-
Current version - 1.15.0
19+
Current version - 1.16.1
2020

2121
You can find the changes for each version in the [change log](https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/master/changelog.txt).
2222

@@ -28,13 +28,13 @@ Find [the latest package in the Maven repository](https://mvnrepository.com/arti
2828
<dependency>
2929
<groupId>com.microsoft.azure</groupId>
3030
<artifactId>msal4j</artifactId>
31-
<version>1.15.0</version>
31+
<version>1.16.1</version>
3232
</dependency>
3333
```
3434
### Gradle
3535

3636
```gradle
37-
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.15.0'
37+
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.16.1'
3838
```
3939

4040
## Usage

msal4j-sdk/bnd.bnd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Export-Package: com.microsoft.aad.msal4j;version="1.15.0"
1+
Export-Package: com.microsoft.aad.msal4j;version="1.16.1"
22
Automatic-Module-Name: com.microsoft.aad.msal4j

msal4j-sdk/pom.xml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.microsoft.azure</groupId>
55
<artifactId>msal4j</artifactId>
6-
<version>1.15.0</version>
6+
<version>1.16.1</version>
77
<packaging>jar</packaging>
88
<name>msal4j</name>
99
<description>
@@ -171,6 +171,33 @@
171171
<build>
172172
<sourceDirectory>${project.build.directory}/delombok</sourceDirectory>
173173
<plugins>
174+
<plugin>
175+
<groupId>org.revapi</groupId>
176+
<artifactId>revapi-maven-plugin</artifactId>
177+
<version>0.15.0</version>
178+
<configuration>
179+
<analysisConfiguration>
180+
<revapi.java>
181+
<checks>
182+
<failBuildOnProblemsFound>false</failBuildOnProblemsFound>
183+
</checks>
184+
</revapi.java>
185+
</analysisConfiguration>
186+
</configuration>
187+
<dependencies>
188+
<dependency>
189+
<groupId>org.revapi</groupId>
190+
<artifactId>revapi-java</artifactId>
191+
<version>0.28.1</version>
192+
</dependency>
193+
</dependencies>
194+
<executions>
195+
<execution>
196+
<id>check</id>
197+
<goals><goal>check</goal></goals>
198+
</execution>
199+
</executions>
200+
</plugin>
174201
<plugin>
175202
<groupId>org.projectlombok</groupId>
176203
<artifactId>lombok-maven-plugin</artifactId>

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/AcquireTokenInteractiveIT.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,6 @@ void acquireTokenInteractive_ADFSv4_Federated(String environment) {
8080
assertAcquireTokenCommon(user, cfg.organizationsAuthority(), cfg.graphDefaultScope());
8181
}
8282

83-
@ParameterizedTest
84-
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
85-
void acquireTokenInteractive_ADFSv3_Federated(String environment) {
86-
cfg = new Config(environment);
87-
88-
User user = labUserProvider.getFederatedAdfsUser(cfg.azureEnvironment, FederationProvider.ADFS_3);
89-
assertAcquireTokenCommon(user, cfg.organizationsAuthority(), cfg.graphDefaultScope());
90-
}
91-
92-
@ParameterizedTest
93-
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
94-
void acquireTokenInteractive_ADFSv2_Federated(String environment) {
95-
cfg = new Config(environment);
96-
97-
User user = labUserProvider.getFederatedAdfsUser(cfg.azureEnvironment, FederationProvider.ADFS_2);
98-
assertAcquireTokenCommon(user, cfg.organizationsAuthority(), cfg.graphDefaultScope());
99-
}
100-
10183
@ParameterizedTest
10284
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
10385
void acquireTokenWithAuthorizationCode_B2C_Local(String environment) {

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/AuthorizationCodeIT.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,6 @@ public void acquireTokenWithAuthorizationCode_ADFSv4_Federated(String environmen
8181
assertAcquireTokenAAD(user, null);
8282
}
8383

84-
@ParameterizedTest
85-
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
86-
public void acquireTokenWithAuthorizationCode_ADFSv3_Federated(String environment) {
87-
cfg = new Config(environment);
88-
89-
User user = labUserProvider.getFederatedAdfsUser(cfg.azureEnvironment, FederationProvider.ADFS_3);
90-
assertAcquireTokenAAD(user, null);
91-
}
92-
93-
@ParameterizedTest
94-
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
95-
public void acquireTokenWithAuthorizationCode_ADFSv2_Federated(String environment) {
96-
cfg = new Config(environment);
97-
98-
User user = labUserProvider.getFederatedAdfsUser(cfg.azureEnvironment, FederationProvider.ADFS_2);
99-
assertAcquireTokenAAD(user, null);
100-
}
101-
10284
@ParameterizedTest
10385
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
10486
public void acquireTokenWithAuthorizationCode_B2C_Local(String environment) {

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/ClientCredentialsIT.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void init() throws CertificateException, UnrecoverableKeyException, NoSuchAlgori
4040

4141
@Test
4242
void acquireTokenClientCredentials_ClientCertificate() throws Exception {
43-
String clientId = "2afb0add-2f32-4946-ac90-81a02aa4550e";
43+
String clientId = TestConstants.MSIDLAB_CLIENT_ID;
4444
assertAcquireTokenCommon(clientId, certificate, TestConstants.MICROSOFT_AUTHORITY);
4545
}
4646

@@ -49,14 +49,14 @@ void acquireTokenClientCredentials_ClientSecret() throws Exception {
4949
AppCredentialProvider appProvider = new AppCredentialProvider(AzureEnvironment.AZURE);
5050
final String clientId = appProvider.getLabVaultAppId();
5151
final String password = appProvider.getLabVaultPassword();
52-
IClientCredential credential = ClientCredentialFactory.createFromSecret(password);
52+
IClientCredential credential = CertificateHelper.getClientCertificate();
5353

5454
assertAcquireTokenCommon(clientId, credential, TestConstants.MICROSOFT_AUTHORITY);
5555
}
5656

5757
@Test
5858
void acquireTokenClientCredentials_ClientAssertion() throws Exception {
59-
String clientId = "2afb0add-2f32-4946-ac90-81a02aa4550e";
59+
String clientId = TestConstants.MSIDLAB_CLIENT_ID;
6060

6161
ClientAssertion clientAssertion = getClientAssertion(clientId);
6262

@@ -90,7 +90,7 @@ void acquireTokenClientCredentials_ClientSecret_Ciam() throws Exception {
9090

9191
@Test
9292
void acquireTokenClientCredentials_Callback() throws Exception {
93-
String clientId = "2afb0add-2f32-4946-ac90-81a02aa4550e";
93+
String clientId = TestConstants.MSIDLAB_CLIENT_ID;
9494

9595
// Creates a valid client assertion using a callback, and uses it to build the client app and make a request
9696
Callable<String> callable = () -> {
@@ -116,11 +116,9 @@ void acquireTokenClientCredentials_Callback() throws Exception {
116116
void acquireTokenClientCredentials_DefaultCacheLookup() throws Exception {
117117
AppCredentialProvider appProvider = new AppCredentialProvider(AzureEnvironment.AZURE);
118118
final String clientId = appProvider.getLabVaultAppId();
119-
final String password = appProvider.getLabVaultPassword();
120-
IClientCredential credential = ClientCredentialFactory.createFromSecret(password);
121119

122120
ConfidentialClientApplication cca = ConfidentialClientApplication.builder(
123-
clientId, credential).
121+
clientId, CertificateHelper.getClientCertificate()).
124122
authority(TestConstants.MICROSOFT_AUTHORITY).
125123
build();
126124

@@ -152,7 +150,7 @@ void acquireTokenClientCredentials_DefaultCacheLookup() throws Exception {
152150

153151
@Test
154152
void acquireTokenClientCredentials_Regional() throws Exception {
155-
String clientId = "2afb0add-2f32-4946-ac90-81a02aa4550e";
153+
String clientId = TestConstants.MSIDLAB_CLIENT_ID;
156154

157155
assertAcquireTokenCommon_withRegion(clientId, certificate, "westus", TestConstants.REGIONAL_MICROSOFT_AUTHORITY_BASIC_HOST_WESTUS);
158156
}

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/TestConstants.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
public class TestConstants {
1111
public final static String KEYVAULT_DEFAULT_SCOPE = "https://vault.azure.net/.default";
12-
public final static String MSIDLAB_DEFAULT_SCOPE = "https://msidlab.com/.default";
12+
public final static String MSIDLAB_DEFAULT_SCOPE = "https://request.msidlab.com/.default";
1313
public final static String MSIDLAB_VAULT_URL = "https://msidlabs.vault.azure.net/";
14+
public final static String MSIDLAB_CLIENT_ID = "f62c5ae3-bf3a-4af5-afa8-a68b800396e9";
1415
public final static String GRAPH_DEFAULT_SCOPE = "https://graph.windows.net/.default";
1516
public final static String USER_READ_SCOPE = "user.read";
1617
public final static String DEFAULT_SCOPE = ".default";
@@ -54,6 +55,7 @@ public class TestConstants {
5455
public final static String B2C_READ_SCOPE = "https://msidlabb2c.onmicrosoft.com/msidlabb2capi/read";
5556
public final static String B2C_MICROSOFTLOGIN_AUTHORITY = "https://msidlabb2c.b2clogin.com/tfp/msidlabb2c.onmicrosoft.com/";
5657
public final static String B2C_MICROSOFTLOGIN_ROPC = B2C_MICROSOFTLOGIN_AUTHORITY + B2C_ROPC_POLICY;
58+
public final static String B2C_UPN = "[email protected]";
5759

5860
public final static String LOCALHOST = "http://localhost:";
5961

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/UsernamePasswordIT.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -78,36 +78,6 @@ void acquireTokenWithUsernamePassword_ADFSv4(String environment) throws Exceptio
7878
assertAcquireTokenCommon(user, cfg.organizationsAuthority(), cfg.graphDefaultScope(), user.getAppId());
7979
}
8080

81-
@ParameterizedTest
82-
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
83-
void acquireTokenWithUsernamePassword_ADFSv3(String environment) throws Exception {
84-
cfg = new Config(environment);
85-
86-
UserQueryParameters query = new UserQueryParameters();
87-
query.parameters.put(UserQueryParameters.AZURE_ENVIRONMENT, cfg.azureEnvironment);
88-
query.parameters.put(UserQueryParameters.FEDERATION_PROVIDER, FederationProvider.ADFS_3);
89-
query.parameters.put(UserQueryParameters.USER_TYPE, UserType.FEDERATED);
90-
91-
User user = labUserProvider.getLabUser(query);
92-
93-
assertAcquireTokenCommon(user, cfg.organizationsAuthority(), cfg.graphDefaultScope(), user.getAppId());
94-
}
95-
96-
@ParameterizedTest
97-
@MethodSource("com.microsoft.aad.msal4j.EnvironmentsProvider#createData")
98-
void acquireTokenWithUsernamePassword_ADFSv2(String environment) throws Exception {
99-
cfg = new Config(environment);
100-
101-
UserQueryParameters query = new UserQueryParameters();
102-
query.parameters.put(UserQueryParameters.AZURE_ENVIRONMENT, cfg.azureEnvironment);
103-
query.parameters.put(UserQueryParameters.FEDERATION_PROVIDER, FederationProvider.ADFS_2);
104-
query.parameters.put(UserQueryParameters.USER_TYPE, UserType.FEDERATED);
105-
106-
User user = labUserProvider.getLabUser(query);
107-
108-
assertAcquireTokenCommonAAD(user);
109-
}
110-
11181
@Test
11282
void acquireTokenWithUsernamePassword_AuthorityWithPort() throws Exception {
11383
User user = labUserProvider.getDefaultUser();

msal4j-sdk/src/integrationtest/java/infrastructure/SeleniumExtensions.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
package infrastructure;
55

6+
import com.microsoft.aad.msal4j.TestConstants;
67
import labapi.FederationProvider;
78
import labapi.LabConstants;
89
import labapi.User;
@@ -76,14 +77,6 @@ public static void performADOrCiamLogin(WebDriver driver, User user) {
7677
LOG.info("Loggin in ... Clicking <Next> after username");
7778
driver.findElement(new By.ById(fields.getAadSignInButtonId())).click();
7879

79-
if (user.getFederationProvider().equals(FederationProvider.ADFS_2) &&
80-
!user.getLabName().equals(LabConstants.ARLINGTON_LAB_NAME)) {
81-
82-
LOG.info("Loggin in ... ADFS-V2 - Entering the username in ADFSv2 form");
83-
driver.findElement(new By.ById(SeleniumConstants.ADFSV2_WEB_USERNAME_INPUT_ID)).
84-
sendKeys(user.getUpn());
85-
}
86-
8780
LOG.info("Loggin in ... Entering password");
8881
By by = new By.ById(fields.getPasswordInputId());
8982
waitForElementToBeVisibleAndEnable(driver, by).sendKeys(user.getPassword());
@@ -155,7 +148,7 @@ public static void performLocalLogin(WebDriver driver, User user) {
155148
driver.findElement(new By.ById(SeleniumConstants.B2C_LOCAL_ACCOUNT_ID)).click();
156149

157150
LOG.info("Loggin in ... Entering username");
158-
driver.findElement(new By.ById(SeleniumConstants.B2C_LOCAL_USERNAME_ID)).sendKeys(user.getUpn());
151+
driver.findElement(new By.ById(SeleniumConstants.B2C_LOCAL_USERNAME_ID)).sendKeys(TestConstants.B2C_UPN);
159152

160153
LOG.info("Loggin in ... Entering password");
161154
By by = new By.ById(SeleniumConstants.B2C_LOCAL_PASSWORD_ID);

msal4j-sdk/src/integrationtest/java/infrastructure/UserInformationFields.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,10 @@ String getADFS2019UserNameInputId() {
4444

4545
private void determineFieldIds() {
4646
switch (user.getFederationProvider()) {
47-
case FederationProvider.ADFS_3:
4847
case FederationProvider.ADFS_2019:
4948
passwordInputId = SeleniumConstants.ADFS2019_PASSWORD_ID;
5049
passwordSigInButtonId = SeleniumConstants.ADFS2019_SUBMIT_ID;
5150
break;
52-
case FederationProvider.ADFS_2:
53-
if (LabConstants.ARLINGTON_LAB_NAME.equals(user.getLabName())) {
54-
passwordInputId = SeleniumConstants.ADFSV2_ARLINGTON_WEB_PASSWORD_INPUT_ID;
55-
passwordSigInButtonId = SeleniumConstants.ADFSV2_ARLINGTON_WEB_SUBMIT_BUTTON_ID;
56-
} else {
57-
passwordInputId = SeleniumConstants.ADFSV2_WEB_PASSWORD_INPUT_ID;
58-
passwordSigInButtonId = SeleniumConstants.ADFSV2_WEB_SUBMIT_BUTTON_ID;
59-
}
60-
break;
6151
case FederationProvider.ADFS_4:
6252
passwordInputId = SeleniumConstants.ADFSV4_WEB_PASSWORD_ID;
6353
passwordSigInButtonId = SeleniumConstants.ADFSV4_WEB_SUBMIT_ID;

msal4j-sdk/src/integrationtest/java/labapi/FederationProvider.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
public class FederationProvider {
77

88
public static final String NONE = "none";
9-
public static final String ADFS_2 = "adfsv2";
10-
public static final String ADFS_3 = "adfsv3";
119
public static final String ADFS_4 = "adfsv4";
1210
public static final String ADFS_2019 = "adfsv2019";
13-
public static final String PING = "ping";
14-
public static final String SHIBBOLETH = "shibboleth";
1511
public static final String CIAM = "ciam";
1612

1713
}

msal4j-sdk/src/integrationtest/java/labapi/KeyVaultSecretsProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public class KeyVaultSecretsProvider {
2121

2222
private final SecretClient secretClient;
2323

24-
private static final String CLIENT_ID = "2afb0add-2f32-4946-ac90-81a02aa4550e";
25-
public static String CERTIFICATE_ALIAS = "MsalJavaAutomationRunner";
24+
private static final String CLIENT_ID = TestConstants.MSIDLAB_CLIENT_ID;
25+
public static String CERTIFICATE_ALIAS = "LabAuth.MSIDLab.com";
2626

2727
private static final String WIN_KEYSTORE = "Windows-MY";
2828
private static final String KEYSTORE_PROVIDER = "SunMSCAPI";
@@ -66,7 +66,7 @@ private AccessToken requestAccessTokenForAutomation() {
6666
try {
6767
ConfidentialClientApplication cca = ConfidentialClientApplication.builder(
6868
CLIENT_ID, getClientCredentialFromKeyStore()).
69-
authority(TestConstants.MICROSOFT_AUTHORITY).
69+
authority(TestConstants.MICROSOFT_AUTHORITY).sendX5c(true).
7070
build();
7171
result = cca.acquireToken(ClientCredentialParameters
7272
.builder(Collections.singleton(TestConstants.KEYVAULT_DEFAULT_SCOPE))
@@ -82,7 +82,7 @@ CLIENT_ID, getClientCredentialFromKeyStore()).
8282
}
8383
}
8484

85-
private IClientCredential getClientCredentialFromKeyStore() {
85+
IClientCredential getClientCredentialFromKeyStore() {
8686
PrivateKey key;
8787
X509Certificate publicCertificate;
8888
try {

msal4j-sdk/src/integrationtest/java/labapi/LabService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ static void initLabApp() throws MalformedURLException {
3333
KeyVaultSecretsProvider keyVaultSecretsProvider = new KeyVaultSecretsProvider();
3434

3535
String appID = keyVaultSecretsProvider.getSecret(LabConstants.APP_ID_KEY_VAULT_SECRET);
36-
String appSecret = keyVaultSecretsProvider.getSecret(LabConstants.APP_PASSWORD_KEY_VAULT_SECRET);
3736

3837
labApp = ConfidentialClientApplication.builder(
39-
appID, ClientCredentialFactory.createFromSecret(appSecret)).
38+
appID, keyVaultSecretsProvider.getClientCredentialFromKeyStore()).
4039
authority(TestConstants.MICROSOFT_AUTHORITY).
4140
build();
4241
}

msal4j-sdk/src/integrationtest/java/labapi/LabUserProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ public User getCiamUser() {
109109

110110
UserQueryParameters query = new UserQueryParameters();
111111
query.parameters.put(UserQueryParameters.FEDERATION_PROVIDER, FederationProvider.CIAM);
112-
query.parameters.put(UserQueryParameters.SIGN_IN_AUDIENCE, "azureadmyorg");
113-
query.parameters.put(UserQueryParameters.PUBLIC_CLIENT, "no");
114112

115113
return getLabUser(query);
116114
}

0 commit comments

Comments
 (0)