Skip to content

Commit 29bd90b

Browse files
authored
Merge pull request #151 from AzureAD/dev
1.2.0 release
2 parents c6d9599 + e871707 commit 29bd90b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1026
-1215
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Quick links:
1212
| --- | --- | --- | --- |
1313

1414
## Install
15-
Current version - 1.1.0
15+
Current version - 1.2.0
1616

1717
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).
1818

@@ -24,13 +24,13 @@ You can get the msal4j package through Maven or Gradle.
2424
<dependency>
2525
<groupId>com.microsoft.azure</groupId>
2626
<artifactId>msal4j</artifactId>
27-
<version>1.1.0</version>
27+
<version>1.2.0</version>
2828
</dependency>
2929
```
3030
### Gradle
3131

3232
```
33-
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.1.0'
33+
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.2.0'
3434
```
3535

3636
## Usage

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Version 1.2.0
2+
=============
3+
- Added support for ADFS 2019
4+
- Added option to add application name and version for telemetry
5+
- Bug fix: support for ClientCredential on Windows for JDK12+ #128
6+
17
Version 1.1.0
28
=============
39
- Added support for configuring HTTP client

pom.xml

Lines changed: 1 addition & 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.1.0</version>
6+
<version>1.2.0</version>
77
<packaging>jar</packaging>
88
<name>msal4j</name>
99
<description>

src/integrationtest/java/com.microsoft.aad.msal4j/AcquireTokenSilentIT.java

Lines changed: 26 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
package com.microsoft.aad.msal4j;
55

6-
import labapi.AppIdentityProvider;
7-
import labapi.FederationProvider;
8-
import labapi.LabResponse;
9-
import labapi.LabUserProvider;
10-
import labapi.NationalCloud;
6+
import labapi.*;
117
import org.testng.Assert;
128
import org.testng.annotations.BeforeClass;
139
import org.testng.annotations.Test;
@@ -50,21 +46,19 @@ public void acquireTokenSilent_OrganizationAuthority_TokenRefreshed() throws Exc
5046
public void acquireTokenSilent_LabAuthority_TokenNotRefreshed() throws Exception {
5147
// Access token should be returned from cache, and not using refresh token
5248

53-
LabResponse labResponse = labUserProvider.getDefaultUser(
54-
NationalCloud.AZURE_CLOUD,
55-
false);
56-
String password = labUserProvider.getUserPassword(labResponse.getUser());
57-
String labAuthority = TestConstants.MICROSOFT_AUTHORITY_HOST + labResponse.getUser().getTenantId();
49+
User user = labUserProvider.getDefaultUser();
50+
51+
String labAuthority = TestConstants.ORGANIZATIONS_AUTHORITY;
5852

5953
PublicClientApplication pca = PublicClientApplication.builder(
60-
labResponse.getAppId()).
54+
user.getAppId()).
6155
authority(labAuthority).
6256
build();
6357

6458
IAuthenticationResult result = pca.acquireToken(UserNamePasswordParameters.
6559
builder(Collections.singleton(TestConstants.GRAPH_DEFAULT_SCOPE),
66-
labResponse.getUser().getUpn(),
67-
password.toCharArray())
60+
user.getUpn(),
61+
user.getPassword().toCharArray())
6862
.build())
6963
.get();
7064

@@ -85,20 +79,17 @@ public void acquireTokenSilent_LabAuthority_TokenNotRefreshed() throws Exception
8579
@Test
8680
public void acquireTokenSilent_ForceRefresh() throws Exception {
8781

88-
LabResponse labResponse = labUserProvider.getDefaultUser(
89-
NationalCloud.AZURE_CLOUD,
90-
false);
91-
String password = labUserProvider.getUserPassword(labResponse.getUser());
82+
User user = labUserProvider.getDefaultUser();
9283

9384
PublicClientApplication pca = PublicClientApplication.builder(
94-
labResponse.getAppId()).
85+
user.getAppId()).
9586
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
9687
build();
9788

9889
IAuthenticationResult result = pca.acquireToken(UserNamePasswordParameters.
9990
builder(Collections.singleton(TestConstants.GRAPH_DEFAULT_SCOPE),
100-
labResponse.getUser().getUpn(),
101-
password.toCharArray())
91+
user.getUpn(),
92+
user.getPassword().toCharArray())
10293
.build())
10394
.get();
10495

@@ -124,24 +115,20 @@ public void acquireTokenSilent_MultipleAccountsInCache_UseCorrectAccount() throw
124115
IPublicClientApplication pca = getPublicClientApplicationWithTokensInCache();
125116

126117
// get lab user for different account
127-
LabResponse labResponse = labUserProvider.getAdfsUser(
128-
FederationProvider.ADFSV4,
129-
true,
130-
false);
131-
String password = labUserProvider.getUserPassword(labResponse.getUser());
118+
User user = labUserProvider.getFederatedAdfsUser(FederationProvider.ADFS_4);
132119

133120
// acquire token for different account
134121
pca.acquireToken(UserNamePasswordParameters.
135122
builder(Collections.singleton(TestConstants.GRAPH_DEFAULT_SCOPE),
136-
labResponse.getUser().getUpn(),
137-
password.toCharArray())
123+
user.getUpn(),
124+
user.getPassword().toCharArray())
138125
.build())
139126
.get();
140127

141128
Set<IAccount> accounts = pca.getAccounts().join();
142129
IAccount account = accounts.stream().filter(
143130
x -> x.username().equalsIgnoreCase(
144-
labResponse.getUser().getUpn())).findFirst().orElse(null);
131+
user.getUpn())).findFirst().orElse(null);
145132

146133
SilentParameters parameters = SilentParameters.builder(
147134
Collections.singleton(TestConstants.GRAPH_DEFAULT_SCOPE), account).
@@ -153,7 +140,7 @@ public void acquireTokenSilent_MultipleAccountsInCache_UseCorrectAccount() throw
153140
Assert.assertNotNull(result);
154141
Assert.assertNotNull(result.accessToken());
155142
Assert.assertNotNull(result.idToken());
156-
Assert.assertEquals(result.account().username(), labResponse.getUser().getUpn());
143+
Assert.assertEquals(result.account().username(), user.getUpn());
157144
}
158145

159146
@Test
@@ -163,10 +150,8 @@ public void acquireTokenSilent_usingCommonAuthority_returnCachedAt() throws Exce
163150

164151
@Test
165152
public void acquireTokenSilent_usingTenantSpecificAuthority_returnCachedAt() throws Exception {
166-
LabResponse labResponse = labUserProvider.getDefaultUser(
167-
NationalCloud.AZURE_CLOUD,
168-
false);
169-
String tenantSpecificAuthority = TestConstants.MICROSOFT_AUTHORITY_HOST + labResponse.getUser().getTenantId();
153+
String tenantSpecificAuthority = TestConstants.ORGANIZATIONS_AUTHORITY;
154+
170155
acquireTokenSilent_returnCachedTokens(tenantSpecificAuthority);
171156
}
172157

@@ -229,20 +214,17 @@ private IConfidentialClientApplication getConfidentialClientApplications() throw
229214

230215
private void acquireTokenSilent_returnCachedTokens(String authority) throws Exception {
231216

232-
LabResponse labResponse = labUserProvider.getDefaultUser(
233-
NationalCloud.AZURE_CLOUD,
234-
false);
235-
String password = labUserProvider.getUserPassword(labResponse.getUser());
217+
User user = labUserProvider.getDefaultUser();
236218

237219
PublicClientApplication pca = PublicClientApplication.builder(
238-
labResponse.getAppId()).
220+
user.getAppId()).
239221
authority(authority).
240222
build();
241223

242224
IAuthenticationResult interactiveAuthResult = pca.acquireToken(UserNamePasswordParameters.
243225
builder(Collections.singleton(TestConstants.GRAPH_DEFAULT_SCOPE),
244-
labResponse.getUser().getUpn(),
245-
password.toCharArray())
226+
user.getUpn(),
227+
user.getPassword().toCharArray())
246228
.build())
247229
.get();
248230

@@ -260,21 +242,18 @@ private void acquireTokenSilent_returnCachedTokens(String authority) throws Exce
260242

261243
private IPublicClientApplication getPublicClientApplicationWithTokensInCache()
262244
throws Exception {
263-
LabResponse labResponse = labUserProvider.getDefaultUser(
264-
NationalCloud.AZURE_CLOUD,
265-
false);
266-
String password = labUserProvider.getUserPassword(labResponse.getUser());
245+
User user = labUserProvider.getDefaultUser();
267246

268247
PublicClientApplication pca = PublicClientApplication.builder(
269-
labResponse.getAppId()).
248+
user.getAppId()).
270249
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
271250
build();
272251

273252
pca.acquireToken(
274253
UserNamePasswordParameters.builder(
275254
Collections.singleton(TestConstants.GRAPH_DEFAULT_SCOPE),
276-
labResponse.getUser().getUpn(),
277-
password.toCharArray())
255+
user.getUpn(),
256+
user.getPassword().toCharArray())
278257
.build()).get();
279258
return pca;
280259
}

0 commit comments

Comments
 (0)