Skip to content

Commit 9140de8

Browse files
Avery-DunnvalfirstErwin Dupontsiddhijain
authored
Release 1.13.1 (#538)
* docs: Improve syntax highlighting in README (#524) * fix: added Automatic-Module-Name to MANIFEST.MF * Documentation update for App token provider * Improvements and bug fixes for regional endpoint support (#535) * Improvements and bug fixes for regional endpoint support * Add links to region documentation * Address code review comments * Allow interactive request timeout to be configurable (#536) * Allow interactive request timeout to be configurable * Address code review comments * Address code review comments * Revert accidental commit to dev branch This reverts commit 5bca22f. * Version updates for 1.13.1 release (#537) Co-authored-by: Valery Yatsynovich <[email protected]> Co-authored-by: Erwin Dupont <[email protected]> Co-authored-by: Siddhi <[email protected]>
1 parent b78eb6e commit 9140de8

File tree

16 files changed

+225
-100
lines changed

16 files changed

+225
-100
lines changed

README.md

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

19-
Current version - 1.13.0
19+
Current version - 1.13.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

2323
You can get the msal4j package through Maven or Gradle.
2424

2525
### Maven
2626
Find [the latest package in the Maven repository](https://mvnrepository.com/artifact/com.microsoft.azure/msal4j).
27-
```
27+
```xml
2828
<dependency>
2929
<groupId>com.microsoft.azure</groupId>
3030
<artifactId>msal4j</artifactId>
31-
<version>1.13.0</version>
31+
<version>1.13.1</version>
3232
</dependency>
3333
```
3434
### Gradle
3535

36-
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.13.0'
36+
```gradle
37+
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.13.1'
38+
```
3739

3840
## Usage
3941

bnd.bnd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Export-Package: com.microsoft.aad.msal4j
2+
Automatic-Module-Name: msal4j

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Version 1.13.1
2+
=============
3+
- Bug fixes and improvements for region API
4+
- Allow configuration of timeouts for interactive requests
5+
- Additional and more informative logging for regional scenarios and token requests in general
6+
17
Version 1.13.0
28
=============
39
- Provide token caching functionality for managed identity tokens

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.13.0</version>
6+
<version>1.13.1</version>
77
<packaging>jar</packaging>
88
<name>msal4j</name>
99
<description>

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

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ public void acquireTokenClientCredentials_DefaultCacheLookup() throws Exception
118118
Assert.assertNotEquals(result2.accessToken(), result3.accessToken());
119119
}
120120

121+
@Test
122+
public void acquireTokenClientCredentials_Regional() throws Exception {
123+
String clientId = "2afb0add-2f32-4946-ac90-81a02aa4550e";
124+
125+
assertAcquireTokenCommon_withRegion(clientId, certificate);
126+
}
127+
121128
private ClientAssertion getClientAssertion(String clientId) {
122129
return JwtHelper.buildJwt(
123130
clientId,
@@ -156,4 +163,57 @@ private void assertAcquireTokenCommon_withParameters(String clientId, IClientCre
156163
Assert.assertNotNull(result);
157164
Assert.assertNotNull(result.accessToken());
158165
}
166+
167+
private void assertAcquireTokenCommon_withRegion(String clientId, IClientCredential credential) throws Exception {
168+
ConfidentialClientApplication ccaNoRegion = ConfidentialClientApplication.builder(
169+
clientId, credential).
170+
authority(TestConstants.MICROSOFT_AUTHORITY).
171+
build();
172+
173+
ConfidentialClientApplication ccaRegion = ConfidentialClientApplication.builder(
174+
clientId, credential).
175+
authority(TestConstants.MICROSOFT_AUTHORITY).azureRegion("westus").
176+
build();
177+
178+
//Ensure behavior when region not specified
179+
IAuthenticationResult resultNoRegion = ccaNoRegion.acquireToken(ClientCredentialParameters
180+
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
181+
.build())
182+
.get();
183+
184+
Assert.assertNotNull(resultNoRegion);
185+
Assert.assertNotNull(resultNoRegion.accessToken());
186+
Assert.assertEquals(resultNoRegion.environment(), TestConstants.MICROSOFT_AUTHORITY_BASIC_HOST);
187+
188+
//Ensure regional tokens are properly cached and retrievable
189+
IAuthenticationResult resultRegion = ccaRegion.acquireToken(ClientCredentialParameters
190+
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
191+
.build())
192+
.get();
193+
194+
Assert.assertNotNull(resultRegion);
195+
Assert.assertNotNull(resultRegion.accessToken());
196+
Assert.assertEquals(resultRegion.environment(), TestConstants.REGIONAL_MICROSOFT_AUTHORITY_BASIC_HOST_WESTUS);
197+
198+
IAuthenticationResult resultRegionCached = ccaRegion.acquireToken(ClientCredentialParameters
199+
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
200+
.build())
201+
.get();
202+
203+
Assert.assertNotNull(resultRegionCached);
204+
Assert.assertNotNull(resultRegionCached.accessToken());
205+
Assert.assertEquals(resultRegionCached.accessToken(), resultRegion.accessToken());
206+
207+
//Tokens retrieved from regional endpoints should be interchangeable with non-regional, and vice-versa
208+
//For example, if an application doesn't configure a region but gets regional tokens added to its cache, they should be retrievable
209+
ccaNoRegion.tokenCache = ccaRegion.tokenCache;
210+
resultNoRegion = ccaNoRegion.acquireToken(ClientCredentialParameters
211+
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
212+
.build())
213+
.get();
214+
215+
Assert.assertNotNull(resultNoRegion);
216+
Assert.assertNotNull(resultNoRegion.accessToken());
217+
Assert.assertEquals(resultNoRegion.accessToken(), resultRegion.accessToken());
218+
}
159219
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class TestConstants {
1818
public final static String B2C_CONFIDENTIAL_CLIENT_LAB_APP_ID = "MSIDLABB2C-MSAapp-AppID";
1919

2020
public final static String MICROSOFT_AUTHORITY_HOST = "https://login.microsoftonline.com/";
21+
public final static String MICROSOFT_AUTHORITY_BASIC_HOST = "login.microsoftonline.com";
2122
public final static String MICROSOFT_AUTHORITY_HOST_WITH_PORT = "https://login.microsoftonline.com:443/";
2223
public final static String ARLINGTON_MICROSOFT_AUTHORITY_HOST = "https://login.microsoftonline.us/";
2324
public final static String MICROSOFT_AUTHORITY_TENANT = "msidlab4.onmicrosoft.com";
@@ -29,6 +30,7 @@ public class TestConstants {
2930
public final static String COMMON_AUTHORITY_WITH_PORT = MICROSOFT_AUTHORITY_HOST_WITH_PORT + "msidlab4.onmicrosoft.com";
3031
public final static String MICROSOFT_AUTHORITY = MICROSOFT_AUTHORITY_HOST + "microsoft.onmicrosoft.com";
3132
public final static String TENANT_SPECIFIC_AUTHORITY = MICROSOFT_AUTHORITY_HOST + MICROSOFT_AUTHORITY_TENANT;
33+
public final static String REGIONAL_MICROSOFT_AUTHORITY_BASIC_HOST_WESTUS = "westus.r." + MICROSOFT_AUTHORITY_BASIC_HOST;
3234

3335
public final static String ARLINGTON_ORGANIZATIONS_AUTHORITY = ARLINGTON_MICROSOFT_AUTHORITY_HOST + "organizations/";
3436
public final static String ARLINGTON_COMMON_AUTHORITY = ARLINGTON_MICROSOFT_AUTHORITY_HOST + "common/";

0 commit comments

Comments
 (0)