Skip to content

Commit

Permalink
Release 1.13.1 (#538)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
4 people authored Sep 16, 2022
1 parent b78eb6e commit 9140de8
Show file tree
Hide file tree
Showing 16 changed files with 225 additions and 100 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,26 @@ Quick links:
The library supports the following Java environments:
- Java 8 (or higher)

Current version - 1.13.0
Current version - 1.13.1

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

You can get the msal4j package through Maven or Gradle.

### Maven
Find [the latest package in the Maven repository](https://mvnrepository.com/artifact/com.microsoft.azure/msal4j).
```
```xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.13.0</version>
<version>1.13.1</version>
</dependency>
```
### Gradle

compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.13.0'
```gradle
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.13.1'
```

## Usage

Expand Down
1 change: 1 addition & 0 deletions bnd.bnd
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Export-Package: com.microsoft.aad.msal4j
Automatic-Module-Name: msal4j
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 1.13.1
=============
- Bug fixes and improvements for region API
- Allow configuration of timeouts for interactive requests
- Additional and more informative logging for regional scenarios and token requests in general

Version 1.13.0
=============
- Provide token caching functionality for managed identity tokens
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.13.0</version>
<version>1.13.1</version>
<packaging>jar</packaging>
<name>msal4j</name>
<description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ public void acquireTokenClientCredentials_DefaultCacheLookup() throws Exception
Assert.assertNotEquals(result2.accessToken(), result3.accessToken());
}

@Test
public void acquireTokenClientCredentials_Regional() throws Exception {
String clientId = "2afb0add-2f32-4946-ac90-81a02aa4550e";

assertAcquireTokenCommon_withRegion(clientId, certificate);
}

private ClientAssertion getClientAssertion(String clientId) {
return JwtHelper.buildJwt(
clientId,
Expand Down Expand Up @@ -156,4 +163,57 @@ private void assertAcquireTokenCommon_withParameters(String clientId, IClientCre
Assert.assertNotNull(result);
Assert.assertNotNull(result.accessToken());
}

private void assertAcquireTokenCommon_withRegion(String clientId, IClientCredential credential) throws Exception {
ConfidentialClientApplication ccaNoRegion = ConfidentialClientApplication.builder(
clientId, credential).
authority(TestConstants.MICROSOFT_AUTHORITY).
build();

ConfidentialClientApplication ccaRegion = ConfidentialClientApplication.builder(
clientId, credential).
authority(TestConstants.MICROSOFT_AUTHORITY).azureRegion("westus").
build();

//Ensure behavior when region not specified
IAuthenticationResult resultNoRegion = ccaNoRegion.acquireToken(ClientCredentialParameters
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
.build())
.get();

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

//Ensure regional tokens are properly cached and retrievable
IAuthenticationResult resultRegion = ccaRegion.acquireToken(ClientCredentialParameters
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
.build())
.get();

Assert.assertNotNull(resultRegion);
Assert.assertNotNull(resultRegion.accessToken());
Assert.assertEquals(resultRegion.environment(), TestConstants.REGIONAL_MICROSOFT_AUTHORITY_BASIC_HOST_WESTUS);

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

Assert.assertNotNull(resultRegionCached);
Assert.assertNotNull(resultRegionCached.accessToken());
Assert.assertEquals(resultRegionCached.accessToken(), resultRegion.accessToken());

//Tokens retrieved from regional endpoints should be interchangeable with non-regional, and vice-versa
//For example, if an application doesn't configure a region but gets regional tokens added to its cache, they should be retrievable
ccaNoRegion.tokenCache = ccaRegion.tokenCache;
resultNoRegion = ccaNoRegion.acquireToken(ClientCredentialParameters
.builder(Collections.singleton(KEYVAULT_DEFAULT_SCOPE))
.build())
.get();

Assert.assertNotNull(resultNoRegion);
Assert.assertNotNull(resultNoRegion.accessToken());
Assert.assertEquals(resultNoRegion.accessToken(), resultRegion.accessToken());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class TestConstants {
public final static String B2C_CONFIDENTIAL_CLIENT_LAB_APP_ID = "MSIDLABB2C-MSAapp-AppID";

public final static String MICROSOFT_AUTHORITY_HOST = "https://login.microsoftonline.com/";
public final static String MICROSOFT_AUTHORITY_BASIC_HOST = "login.microsoftonline.com";
public final static String MICROSOFT_AUTHORITY_HOST_WITH_PORT = "https://login.microsoftonline.com:443/";
public final static String ARLINGTON_MICROSOFT_AUTHORITY_HOST = "https://login.microsoftonline.us/";
public final static String MICROSOFT_AUTHORITY_TENANT = "msidlab4.onmicrosoft.com";
Expand All @@ -29,6 +30,7 @@ public class TestConstants {
public final static String COMMON_AUTHORITY_WITH_PORT = MICROSOFT_AUTHORITY_HOST_WITH_PORT + "msidlab4.onmicrosoft.com";
public final static String MICROSOFT_AUTHORITY = MICROSOFT_AUTHORITY_HOST + "microsoft.onmicrosoft.com";
public final static String TENANT_SPECIFIC_AUTHORITY = MICROSOFT_AUTHORITY_HOST + MICROSOFT_AUTHORITY_TENANT;
public final static String REGIONAL_MICROSOFT_AUTHORITY_BASIC_HOST_WESTUS = "westus.r." + MICROSOFT_AUTHORITY_BASIC_HOST;

public final static String ARLINGTON_ORGANIZATIONS_AUTHORITY = ARLINGTON_MICROSOFT_AUTHORITY_HOST + "organizations/";
public final static String ARLINGTON_COMMON_AUTHORITY = ARLINGTON_MICROSOFT_AUTHORITY_HOST + "common/";
Expand Down
Loading

0 comments on commit 9140de8

Please sign in to comment.