Skip to content

1.6.2 release #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2020
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Quick links:
The library supports the following Java environments:
- Java 8 (or higher)

Current version - 1.6.1
Current version - 1.6.2

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

Expand All @@ -28,13 +28,13 @@ Find [the latest package in the Maven repository](https://mvnrepository.com/arti
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.6.1</version>
<version>1.6.2</version>
</dependency>
```
### Gradle

```
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.6.1'
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.6.2'
```

## Usage
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 1.6.2
=============
- Fix for "NullPointerException during accessing B2C authority aliases"
- Adding extraScopesToConsent parameter to AuthorizationRequestUrlParameters builder.
Can be used to request the end user to consent upfront,
in addition to scopes which the application is requesting access to.

Version 1.6.1
=============
- Compatibility with json-smart [1.3.1 - 2.3]
Expand Down
3 changes: 1 addition & 2 deletions 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.6.1</version>
<version>1.6.2</version>
<packaging>jar</packaging>
<name>msal4j</name>
<description>
Expand Down Expand Up @@ -55,7 +55,6 @@
<version>2.10.1</version>
</dependency>


<!-- test dependencies -->
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ public void acquireTokenWithUsernamePassword_B2C_CustomAuthority() throws Except
Assert.assertNotNull(result);
Assert.assertNotNull(result.accessToken());
Assert.assertNotNull(result.idToken());

IAccount account = pca.getAccounts().join().iterator().next();
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account);

result = pca.acquireTokenSilently(
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account)
.build())
.get();

Assert.assertNotNull(result);
Assert.assertNotNull(result.accessToken());
Assert.assertNotNull(result.idToken());
}

@Test
Expand All @@ -173,5 +185,17 @@ public void acquireTokenWithUsernamePassword_B2C_LoginMicrosoftOnline() throws E
Assert.assertNotNull(result);
Assert.assertNotNull(result.accessToken());
Assert.assertNotNull(result.idToken());

IAccount account = pca.getAccounts().join().iterator().next();
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account);

result = pca.acquireTokenSilently(
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account)
.build())
.get();

Assert.assertNotNull(result);
Assert.assertNotNull(result.accessToken());
Assert.assertNotNull(result.idToken());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static AadInstanceDiscoveryResponse parseInstanceDiscoveryMetadata(String instan
static void cacheInstanceDiscoveryMetadata(String host,
AadInstanceDiscoveryResponse aadInstanceDiscoveryResponse) {

if (aadInstanceDiscoveryResponse.metadata() != null) {
if (aadInstanceDiscoveryResponse != null && aadInstanceDiscoveryResponse.metadata() != null) {
for (InstanceDiscoveryMetadataEntry entry : aadInstanceDiscoveryResponse.metadata()) {
for (String alias: entry.aliases()) {
cache.put(alias, entry);
Expand All @@ -83,7 +83,9 @@ static void cacheInstanceDiscoveryMetadata(String host,
}
cache.putIfAbsent(host, InstanceDiscoveryMetadataEntry.builder().
preferredCache(host).
preferredNetwork(host).build());
preferredNetwork(host).
aliases(Collections.singleton(host)).
build());
}

private static String getAuthorizeEndpoint(String host, String tenant) {
Expand Down Expand Up @@ -127,11 +129,14 @@ private static void doInstanceDiscoveryAndCache(URL authorityUrl,
MsalRequest msalRequest,
ServiceBundle serviceBundle) {

AadInstanceDiscoveryResponse aadInstanceDiscoveryResponse =
sendInstanceDiscoveryRequest(authorityUrl, msalRequest, serviceBundle);
AadInstanceDiscoveryResponse aadInstanceDiscoveryResponse = null;

if (validateAuthority) {
validate(aadInstanceDiscoveryResponse);
if(msalRequest.application().authenticationAuthority.authorityType.equals(AuthorityType.AAD)) {
aadInstanceDiscoveryResponse = sendInstanceDiscoveryRequest(authorityUrl, msalRequest, serviceBundle);

if (validateAuthority) {
validate(aadInstanceDiscoveryResponse);
}
}

cacheInstanceDiscoveryMetadata(authorityUrl.getAuthority(), aadInstanceDiscoveryResponse);
Expand Down
2 changes: 1 addition & 1 deletion src/samples/msal-b2c-web-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.6.1</version>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/msal-obo-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.6.1</version>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/msal-web-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.6.1</version>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
Expand Down