Skip to content

Commit 1f68791

Browse files
authored
Merge pull request #982 from AzureAD/avdunn/release-1.30.0-beta
Remove third-party dependencies from msal4j package
2 parents 3762d5c + 77a438b commit 1f68791

File tree

95 files changed

+3593
-1841
lines changed

Some content is hidden

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

95 files changed

+3593
-1841
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.22.0
19+
Current version - 1.30.0-beta
2020

2121
You can find the changes for each version in the [change log](https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/main/msal4j-sdk/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.22.0</version>
31+
<version>1.30.0-beta</version>
3232
</dependency>
3333
```
3434
### Gradle
3535

3636
```gradle
37-
implementation group: 'com.microsoft.azure', name: 'com.microsoft.aad.msal4j', version: '1.22.0'
37+
implementation group: 'com.microsoft.azure', name: 'com.microsoft.aad.msal4j', version: '1.30.0-beta'
3838
```
3939

4040
## Usage

changelog.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Version 1.30.0-beta
2+
=============
3+
- Replace org.projectlombok dependencies with implementations of generated code (#946)
4+
- Replace com.nimbusds dependencies with implementations of OAuth behavior (#926, #927, #928, #941, #945)
5+
- Replace com.fasterxml.jackson with com.azure.json for JSON behavior (#947, #948)
6+
17
Version 1.22.0
28
=============
39
- Validate issuer from OIDC endpoint when using the oidcAuthority() API (#970)
@@ -11,7 +17,7 @@ Version 1.21.0
1117
- Fix query parameter issue in IMDS scenarios (#954)
1218
- Update dependencies used in tests to avoid CVE warnings (#962)
1319

14-
Version 1.20.1
20+
1.20.1
1521
=============
1622
- Fix Base64URL decoding bug (#938)
1723

msal4j-sdk/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.22.0
19+
Current version - 1.30.0-beta
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.22.0</version>
31+
<version>1.30.0-beta</version>
3232
</dependency>
3333
```
3434
### Gradle
3535

3636
```gradle
37-
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.22.0'
37+
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.30.0-beta'
3838
```
3939

4040
## Usage

msal4j-sdk/bnd.bnd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Export-Package: com.microsoft.aad.msal4j;version="1.22.0"
1+
Export-Package: com.microsoft.aad.msal4j;version="1.30.0-beta"
22
Automatic-Module-Name: com.microsoft.aad.msal4j

msal4j-sdk/pom.xml

Lines changed: 43 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<groupId>com.microsoft.azure</groupId>
5-
<artifactId>msal4j</artifactId>
6-
<version>1.22.0</version>
7-
<packaging>jar</packaging>
8-
<name>msal4j</name>
9-
<description>
10-
Microsoft Authentication Library for Java gives you the ability to obtain tokens from Microsoft Entra (work and
11-
school accounts, MSA) and Azure AD B2C, gaining access to Microsoft Cloud API and any other API secured by Microsoft
12-
identities
13-
</description>
14-
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
15-
<developers>
16-
<developer>
17-
<id>msopentech</id>
18-
<name>Microsoft Open Technologies, Inc.</name>
19-
</developer>
20-
</developers>
21-
<licenses>
22-
<license>
23-
<name>MIT License</name>
24-
</license>
25-
</licenses>
26-
<inceptionYear>2013</inceptionYear>
27-
<scm>
28-
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
29-
</scm>
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.microsoft.azure</groupId>
5+
<artifactId>msal4j</artifactId>
6+
<version>1.30.0-beta</version>
7+
<packaging>jar</packaging>
8+
<name>msal4j</name>
9+
<description>
10+
Microsoft Authentication Library for Java gives you the ability to obtain tokens from Azure AD v2 (work and school
11+
accounts, MSA) and Azure AD B2C, gaining access to Microsoft Cloud API and any other API secured by Microsoft
12+
identities
13+
</description>
14+
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
15+
<developers>
16+
<developer>
17+
<id>msopentech</id>
18+
<name>Microsoft Open Technologies, Inc.</name>
19+
</developer>
20+
</developers>
21+
<licenses>
22+
<license>
23+
<name>MIT License</name>
24+
</license>
25+
</licenses>
26+
<inceptionYear>2013</inceptionYear>
27+
<scm>
28+
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
29+
</scm>
3030

3131
<properties>
3232
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -39,45 +39,30 @@
3939
</properties>
4040

4141
<dependencies>
42-
<dependency>
43-
<groupId>com.nimbusds</groupId>
44-
<artifactId>oauth2-oidc-sdk</artifactId>
45-
<version>11.23.1</version>
46-
</dependency>
47-
<dependency>
48-
<groupId>net.minidev</groupId>
49-
<artifactId>json-smart</artifactId>
50-
<version>2.5.2</version>
51-
</dependency>
5242
<dependency>
5343
<groupId>org.slf4j</groupId>
5444
<artifactId>slf4j-api</artifactId>
5545
<version>1.7.36</version>
5646
</dependency>
57-
<dependency>
58-
<groupId>org.slf4j</groupId>
59-
<artifactId>slf4j-simple</artifactId>
60-
<version>1.6.2</version>
61-
<scope>test</scope>
62-
</dependency>
63-
<dependency>
64-
<groupId>org.projectlombok</groupId>
65-
<artifactId>lombok</artifactId>
66-
<version>1.18.36</version>
67-
<scope>provided</scope>
68-
</dependency>
6947
<dependency>
7048
<groupId>com.azure</groupId>
7149
<artifactId>azure-json</artifactId>
7250
<version>1.4.0</version>
7351
</dependency>
74-
<dependency>
75-
<groupId>com.fasterxml.jackson.core</groupId>
76-
<artifactId>jackson-databind</artifactId>
77-
<version>2.18.1</version>
78-
</dependency>
7952

8053
<!-- test dependencies -->
54+
<dependency>
55+
<groupId>com.nimbusds</groupId>
56+
<artifactId>oauth2-oidc-sdk</artifactId>
57+
<version>11.23</version>
58+
<scope>test</scope>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.slf4j</groupId>
62+
<artifactId>slf4j-simple</artifactId>
63+
<version>1.6.2</version>
64+
<scope>test</scope>
65+
</dependency>
8166
<dependency>
8267
<groupId>org.junit.jupiter</groupId>
8368
<artifactId>junit-jupiter-api</artifactId>
@@ -167,7 +152,7 @@
167152
</pluginRepositories>
168153

169154
<build>
170-
<sourceDirectory>${project.build.directory}/delombok</sourceDirectory>
155+
<sourceDirectory>src/main/java</sourceDirectory>
171156
<plugins>
172157
<plugin>
173158
<groupId>org.revapi</groupId>
@@ -198,30 +183,7 @@
198183
</execution>
199184
</executions>
200185
</plugin>
201-
<plugin>
202-
<groupId>org.projectlombok</groupId>
203-
<artifactId>lombok-maven-plugin</artifactId>
204-
<version>1.18.20.0</version>
205-
<dependencies>
206-
<dependency>
207-
<groupId>org.projectlombok</groupId>
208-
<artifactId>lombok</artifactId>
209-
<version>1.18.36</version>
210-
</dependency>
211-
</dependencies>
212-
<executions>
213-
<execution>
214-
<goals>
215-
<goal>delombok</goal>
216-
</goals>
217-
</execution>
218-
</executions>
219-
<configuration>
220-
<sourceDirectory>src/main/java</sourceDirectory>
221-
<outputDirectory>${project.build.directory}/delombok</outputDirectory>
222-
<addOutputDirectory>false</addOutputDirectory>
223-
</configuration>
224-
</plugin>
186+
225187
<plugin>
226188
<groupId>org.apache.maven.plugins</groupId>
227189
<artifactId>maven-jar-plugin</artifactId>
@@ -250,7 +212,7 @@
250212
<artifactId>maven-javadoc-plugin</artifactId>
251213
<version>3.1.0</version>
252214
<configuration>
253-
<sourcepath>${project.build.directory}/delombok</sourcepath>
215+
<sourcepath>src/main/java</sourcepath>
254216
</configuration>
255217
<executions>
256218
<execution>

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/AcquireTokenInteractiveIT.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -212,42 +212,6 @@ private IAuthenticationResult acquireTokenSilently(IPublicClientApplication pca,
212212
.get();
213213
}
214214

215-
public void acquireTokensInHomeAndGuestClouds(String homeCloud) throws MalformedURLException {
216-
217-
User user = labUserProvider.getUserByGuestHomeAzureEnvironments
218-
(AzureEnvironment.AZURE, homeCloud);
219-
220-
// use user`s upn from home cloud
221-
user.setUpn(user.getHomeUPN());
222-
223-
ITokenCacheAccessAspect persistenceAspect = new ITokenCacheAccessAspect() {
224-
String data;
225-
226-
@Override
227-
public void beforeCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext) {
228-
iTokenCacheAccessContext.tokenCache().deserialize(data);
229-
}
230-
231-
@Override
232-
public void afterCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext) {
233-
data = iTokenCacheAccessContext.tokenCache().serialize();
234-
}
235-
};
236-
237-
PublicClientApplication publicCloudPca = PublicClientApplication.builder(
238-
user.getAppId()).
239-
authority(TestConstants.AUTHORITY_PUBLIC_TENANT_SPECIFIC).setTokenCacheAccessAspect(persistenceAspect).
240-
build();
241-
242-
IAuthenticationResult result = acquireTokenInteractive(user, publicCloudPca, TestConstants.USER_READ_SCOPE);
243-
IntegrationTestHelper.assertAccessAndIdTokensNotNull(result);
244-
assertEquals(user.getHomeUPN(), result.account().username());
245-
246-
publicCloudPca.removeAccount(publicCloudPca.getAccounts().join().iterator().next()).join();
247-
248-
assertEquals(publicCloudPca.getAccounts().join().size(), 0);
249-
}
250-
251215
private IAuthenticationResult acquireTokenInteractive(
252216
User user,
253217
PublicClientApplication pca,

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/CachePersistenceIT.java

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@
22
// Licensed under the MIT License.
33
package com.microsoft.aad.msal4j;
44

5-
import com.nimbusds.jwt.JWTClaimsSet;
6-
import com.nimbusds.jwt.PlainJWT;
75
import org.junit.jupiter.api.Test;
86
import org.junit.jupiter.api.TestInstance;
97
import static org.junit.jupiter.api.Assertions.assertEquals;
108

11-
import java.io.IOException;
12-
import java.net.URISyntaxException;
13-
import java.util.Collections;
14-
159
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
1610
class CachePersistenceIT {
1711

@@ -34,59 +28,50 @@ public void afterCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext)
3428
}
3529

3630
@Test
37-
void cacheDeserializationSerializationTest() throws IOException, URISyntaxException {
31+
void cacheDeserializationSerializationTest() {
3832
String dataToInitCache = TestHelper.readResource(this.getClass(), "/cache_data/serialized_cache.json");
39-
40-
String ID_TOKEN_PLACEHOLDER = "<idToken_placeholder>";
41-
JWTClaimsSet claimsSet = new JWTClaimsSet.Builder()
42-
.audience(Collections.singletonList("jwtAudience"))
43-
.issuer("issuer")
44-
.subject("subject")
45-
.build();
46-
PlainJWT jwt = new PlainJWT(claimsSet);
47-
48-
dataToInitCache = dataToInitCache.replace(ID_TOKEN_PLACEHOLDER, jwt.serialize());
33+
dataToInitCache = dataToInitCache.replace("<idToken_placeholder>", TestHelper.ENCODED_JWT);
4934

5035
ITokenCacheAccessAspect persistenceAspect = new TokenPersistence(dataToInitCache);
5136

5237
PublicClientApplication app = PublicClientApplication.builder("my_client_id")
5338
.setTokenCacheAccessAspect(persistenceAspect).build();
5439

55-
assertEquals(app.getAccounts().join().size(), 1);
56-
assertEquals(app.tokenCache.accounts.size(), 1);
57-
assertEquals(app.tokenCache.accessTokens.size(), 2);
58-
assertEquals(app.tokenCache.refreshTokens.size(), 1);
59-
assertEquals(app.tokenCache.idTokens.size(), 1);
60-
assertEquals(app.tokenCache.appMetadata.size(), 1);
40+
assertEquals(1, app.getAccounts().join().size());
41+
assertEquals(1, app.tokenCache.accounts.size());
42+
assertEquals(1, app.tokenCache.accessTokens.size());
43+
assertEquals(1, app.tokenCache.refreshTokens.size());
44+
assertEquals(1, app.tokenCache.idTokens.size());
45+
assertEquals(1, app.tokenCache.appMetadata.size());
6146

6247
// create new instance of app to make sure in memory cache cleared
6348
app = PublicClientApplication.builder("my_client_id")
6449
.setTokenCacheAccessAspect(persistenceAspect).build();
6550

66-
assertEquals(app.getAccounts().join().size(), 1);
67-
assertEquals(app.tokenCache.accounts.size(), 1);
68-
assertEquals(app.tokenCache.accessTokens.size(), 2);
69-
assertEquals(app.tokenCache.refreshTokens.size(), 1);
70-
assertEquals(app.tokenCache.idTokens.size(), 1);
71-
assertEquals(app.tokenCache.appMetadata.size(), 1);
51+
assertEquals(1, app.getAccounts().join().size());
52+
assertEquals(1, app.tokenCache.accounts.size());
53+
assertEquals(1, app.tokenCache.accessTokens.size());
54+
assertEquals(1, app.tokenCache.refreshTokens.size());
55+
assertEquals(1, app.tokenCache.idTokens.size());
56+
assertEquals(1, app.tokenCache.appMetadata.size());
7257

7358
app.removeAccount(app.getAccounts().join().iterator().next()).join();
7459

75-
assertEquals(app.getAccounts().join().size(), 0);
76-
assertEquals(app.tokenCache.accounts.size(), 0);
77-
assertEquals(app.tokenCache.accessTokens.size(), 1);
78-
assertEquals(app.tokenCache.refreshTokens.size(), 0);
79-
assertEquals(app.tokenCache.idTokens.size(), 0);
80-
assertEquals(app.tokenCache.appMetadata.size(), 1);
60+
assertEquals(0, app.getAccounts().join().size());
61+
assertEquals(0, app.tokenCache.accounts.size());
62+
assertEquals(0, app.tokenCache.accessTokens.size());
63+
assertEquals(0, app.tokenCache.refreshTokens.size());
64+
assertEquals(0, app.tokenCache.idTokens.size());
65+
assertEquals(1, app.tokenCache.appMetadata.size());
8166

8267
app = PublicClientApplication.builder("my_client_id")
8368
.setTokenCacheAccessAspect(persistenceAspect).build();
8469

85-
assertEquals(app.getAccounts().join().size(), 0);
86-
assertEquals(app.tokenCache.accounts.size(), 0);
87-
assertEquals(app.tokenCache.accessTokens.size(), 1);
88-
assertEquals(app.tokenCache.refreshTokens.size(), 0);
89-
assertEquals(app.tokenCache.idTokens.size(), 0);
90-
assertEquals(app.tokenCache.appMetadata.size(), 1);
70+
assertEquals(0, app.getAccounts().join().size());
71+
assertEquals(0, app.tokenCache.accounts.size());
72+
assertEquals(0, app.tokenCache.accessTokens.size());
73+
assertEquals(0, app.tokenCache.refreshTokens.size());
74+
assertEquals(0, app.tokenCache.idTokens.size());
75+
assertEquals(1, app.tokenCache.appMetadata.size());
9176
}
9277
}

0 commit comments

Comments
 (0)