Skip to content

Commit 3a0f636

Browse files
authored
1.6.2 release (#268)
1 parent 7213c0c commit 3a0f636

File tree

8 files changed

+49
-14
lines changed

8 files changed

+49
-14
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.6.1
19+
Current version - 1.6.2
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.6.1</version>
31+
<version>1.6.2</version>
3232
</dependency>
3333
```
3434
### Gradle
3535

3636
```
37-
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.6.1'
37+
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.6.2'
3838
```
3939

4040
## Usage

changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Version 1.6.2
2+
=============
3+
- Fix for "NullPointerException during accessing B2C authority aliases"
4+
- Adding extraScopesToConsent parameter to AuthorizationRequestUrlParameters builder.
5+
Can be used to request the end user to consent upfront,
6+
in addition to scopes which the application is requesting access to.
7+
18
Version 1.6.1
29
=============
310
- Compatibility with json-smart [1.3.1 - 2.3]

pom.xml

Lines changed: 1 addition & 2 deletions
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.6.1</version>
6+
<version>1.6.2</version>
77
<packaging>jar</packaging>
88
<name>msal4j</name>
99
<description>
@@ -55,7 +55,6 @@
5555
<version>2.10.1</version>
5656
</dependency>
5757

58-
5958
<!-- test dependencies -->
6059
<dependency>
6160
<groupId>org.apache.commons</groupId>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ public void acquireTokenWithUsernamePassword_B2C_CustomAuthority() throws Except
149149
Assert.assertNotNull(result);
150150
Assert.assertNotNull(result.accessToken());
151151
Assert.assertNotNull(result.idToken());
152+
153+
IAccount account = pca.getAccounts().join().iterator().next();
154+
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account);
155+
156+
result = pca.acquireTokenSilently(
157+
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account)
158+
.build())
159+
.get();
160+
161+
Assert.assertNotNull(result);
162+
Assert.assertNotNull(result.accessToken());
163+
Assert.assertNotNull(result.idToken());
152164
}
153165

154166
@Test
@@ -173,5 +185,17 @@ public void acquireTokenWithUsernamePassword_B2C_LoginMicrosoftOnline() throws E
173185
Assert.assertNotNull(result);
174186
Assert.assertNotNull(result.accessToken());
175187
Assert.assertNotNull(result.idToken());
188+
189+
IAccount account = pca.getAccounts().join().iterator().next();
190+
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account);
191+
192+
result = pca.acquireTokenSilently(
193+
SilentParameters.builder(Collections.singleton(TestConstants.B2C_READ_SCOPE), account)
194+
.build())
195+
.get();
196+
197+
Assert.assertNotNull(result);
198+
Assert.assertNotNull(result.accessToken());
199+
Assert.assertNotNull(result.idToken());
176200
}
177201
}

src/main/java/com/microsoft/aad/msal4j/AadInstanceDiscoveryProvider.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static AadInstanceDiscoveryResponse parseInstanceDiscoveryMetadata(String instan
7474
static void cacheInstanceDiscoveryMetadata(String host,
7575
AadInstanceDiscoveryResponse aadInstanceDiscoveryResponse) {
7676

77-
if (aadInstanceDiscoveryResponse.metadata() != null) {
77+
if (aadInstanceDiscoveryResponse != null && aadInstanceDiscoveryResponse.metadata() != null) {
7878
for (InstanceDiscoveryMetadataEntry entry : aadInstanceDiscoveryResponse.metadata()) {
7979
for (String alias: entry.aliases()) {
8080
cache.put(alias, entry);
@@ -83,7 +83,9 @@ static void cacheInstanceDiscoveryMetadata(String host,
8383
}
8484
cache.putIfAbsent(host, InstanceDiscoveryMetadataEntry.builder().
8585
preferredCache(host).
86-
preferredNetwork(host).build());
86+
preferredNetwork(host).
87+
aliases(Collections.singleton(host)).
88+
build());
8789
}
8890

8991
private static String getAuthorizeEndpoint(String host, String tenant) {
@@ -127,11 +129,14 @@ private static void doInstanceDiscoveryAndCache(URL authorityUrl,
127129
MsalRequest msalRequest,
128130
ServiceBundle serviceBundle) {
129131

130-
AadInstanceDiscoveryResponse aadInstanceDiscoveryResponse =
131-
sendInstanceDiscoveryRequest(authorityUrl, msalRequest, serviceBundle);
132+
AadInstanceDiscoveryResponse aadInstanceDiscoveryResponse = null;
132133

133-
if (validateAuthority) {
134-
validate(aadInstanceDiscoveryResponse);
134+
if(msalRequest.application().authenticationAuthority.authorityType.equals(AuthorityType.AAD)) {
135+
aadInstanceDiscoveryResponse = sendInstanceDiscoveryRequest(authorityUrl, msalRequest, serviceBundle);
136+
137+
if (validateAuthority) {
138+
validate(aadInstanceDiscoveryResponse);
139+
}
135140
}
136141

137142
cacheInstanceDiscoveryMetadata(authorityUrl.getAuthority(), aadInstanceDiscoveryResponse);

src/samples/msal-b2c-web-sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.microsoft.azure</groupId>
2525
<artifactId>msal4j</artifactId>
26-
<version>1.6.1</version>
26+
<version>1.6.2</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.nimbusds</groupId>

src/samples/msal-obo-sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.microsoft.azure</groupId>
2525
<artifactId>msal4j</artifactId>
26-
<version>1.6.1</version>
26+
<version>1.6.2</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.nimbusds</groupId>

src/samples/msal-web-sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.microsoft.azure</groupId>
2525
<artifactId>msal4j</artifactId>
26-
<version>1.6.1</version>
26+
<version>1.6.2</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.nimbusds</groupId>

0 commit comments

Comments
 (0)