Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
29add9f
Remove usage of com.nimbusds.oauth2 from grant-related classes
Avery-Dunn Mar 27, 2025
a660a03
Refactor and address PR feedback
Avery-Dunn Mar 28, 2025
8e3b9d9
Remove com.nimbusds's HTTPRequest, ClientAuthentication, and related …
Avery-Dunn Apr 1, 2025
e5f8b53
Remove com.nimbusds's HTTPRequest, ClientAuthentication, and related …
Avery-Dunn Apr 1, 2025
aa16f7d
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
Avery-Dunn Apr 1, 2025
579e4d1
Resolve merge conflicts
Avery-Dunn Apr 1, 2025
c9d4237
Fix unit tests
Avery-Dunn Apr 1, 2025
82d0ec8
Remove com.nimbusds's imports related to Tokens
Avery-Dunn Apr 1, 2025
be2debc
Address PR feedback
Avery-Dunn Apr 4, 2025
962405a
Merge pull request #928 from AzureAD/avdunn/nimbus-tokens
Avery-Dunn Apr 4, 2025
70d4312
Merge pull request #927 from AzureAD/avdunn/nimbus-http
Avery-Dunn Apr 4, 2025
450d71a
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
Avery-Dunn Apr 10, 2025
5440a80
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
Avery-Dunn Apr 10, 2025
dc13c46
Address PR feedback
Avery-Dunn Apr 10, 2025
7580409
Merge branch 'avdunn/nimbus-removal' of https://github.com/AzureAD/mi…
Avery-Dunn Apr 14, 2025
1643890
PR feedback, and correctly adjust parameters in ADFS username/passwor…
Avery-Dunn Apr 16, 2025
f264456
Remove and replace various Nimbus imports
Avery-Dunn Apr 23, 2025
efbf08e
Represent query parameters with Map<String, String> instead of Map<St…
Avery-Dunn Apr 23, 2025
4009b7a
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
Avery-Dunn Apr 25, 2025
8be97d5
Merge latest dev
Avery-Dunn Apr 25, 2025
cac03fc
Fix comment
Avery-Dunn Apr 25, 2025
700a850
Merge pull request #926 from AzureAD/avdunn/nimbus-grants
Avery-Dunn Apr 25, 2025
03ae326
Fix comment
Avery-Dunn Apr 25, 2025
cf869a0
Merge branch 'avdunn/nimbus-removal' of https://github.com/AzureAD/mi…
Avery-Dunn Apr 25, 2025
cd495fa
Merge pull request #942 from AzureAD/avdunn/nimbus-map
Avery-Dunn Apr 25, 2025
66dea81
Merge branch 'avdunn/nimbus-removal' of https://github.com/AzureAD/mi…
Avery-Dunn Apr 25, 2025
8d1f418
Address PR feedback
Avery-Dunn Apr 25, 2025
19aaaf1
Remove nimbus from main library
Avery-Dunn Apr 29, 2025
67d3131
Final Lombok removal
Avery-Dunn Apr 30, 2025
0ea4362
Use azure-json in claims classes
Avery-Dunn May 5, 2025
1ae637e
Replace com.fasterxml.jackson with com.azure.json
Avery-Dunn May 7, 2025
1fa1939
Add more tests and improve helper methods to better match nimbus beha…
Avery-Dunn May 7, 2025
979ff0c
Very minor issue, but in a public method nonetheless
Avery-Dunn May 7, 2025
7b36cbc
Merge pull request #946 from AzureAD/avdunn/lombok-final
Avery-Dunn May 7, 2025
f0d8e24
Merge pull request #941 from AzureAD/avdunn/nimbus-utils
Avery-Dunn May 7, 2025
9c26b83
Address PR feedback
Avery-Dunn May 7, 2025
90d1a9e
Merge pull request #948 from AzureAD/avdunn/json-cache-entities
Avery-Dunn May 8, 2025
4cf5133
Address PR feedback
Avery-Dunn May 8, 2025
aa30533
Merge pull request #947 from AzureAD/avdunn/json-claimsrequest
Avery-Dunn May 8, 2025
9de706c
Address PR feedback
Avery-Dunn May 8, 2025
97658be
Merge remote-tracking branch 'origin/avdunn/nimbus-json' into avdunn/…
Avery-Dunn May 8, 2025
c3e41be
Merge pull request #945 from AzureAD/avdunn/nimbus-json
Avery-Dunn May 8, 2025
169c2b0
Merge pull request #950 from AzureAD/avdunn/nimbus-utils
Avery-Dunn May 8, 2025
ccb50b1
Merge remote-tracking branch 'origin/avdunn/nimbus-removal' into avdu…
Avery-Dunn May 8, 2025
75abea0
Resolve merge conflicts
Avery-Dunn May 8, 2025
241f6f6
Merge pull request #949 from AzureAD/avdunn/json-removal
Avery-Dunn May 8, 2025
b4d9b86
Final dependency changes in test classes, and cleanup of various unus…
Avery-Dunn May 8, 2025
7320a8d
Merge branch 'dev' into avdunn/nimbus-removal
Avery-Dunn May 12, 2025
e310f06
Merge branch 'dev' into avdunn/dependency-cleanup
Avery-Dunn May 12, 2025
295f466
Merge pull request #951 from AzureAD/avdunn/dependency-cleanup
Avery-Dunn May 12, 2025
f8799dc
Merge pull request #953 from AzureAD/avdunn/nimbus-removal
Avery-Dunn May 12, 2025
4f5a10c
Version updates for 1.30.0-beta
Avery-Dunn May 12, 2025
4699522
Merge remote-tracking branch 'origin/avdunn/release-1.30.0-beta' into…
Avery-Dunn May 12, 2025
956bcb1
Merge branch 'dev' into avdunn/merge-conflicts
Avery-Dunn Jul 29, 2025
dfae289
Resolve merge conflicts
Avery-Dunn Jul 29, 2025
62a6622
Resolve merge conflicts
Avery-Dunn Aug 6, 2025
5fc9dae
Remove duplicated dependency
Avery-Dunn Aug 6, 2025
669770e
Merge branch 'dev' into avdunn/merge-conflicts
Avery-Dunn Aug 7, 2025
77a438b
Merge pull request #978 from AzureAD/avdunn/merge-conflicts
Avery-Dunn Aug 12, 2025
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.22.0
Current version - 1.30.0-beta

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

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.22.0</version>
<version>1.30.0-beta</version>
</dependency>
```
### Gradle

```gradle
implementation group: 'com.microsoft.azure', name: 'com.microsoft.aad.msal4j', version: '1.22.0'
implementation group: 'com.microsoft.azure', name: 'com.microsoft.aad.msal4j', version: '1.30.0-beta'
```

## Usage
Expand Down
8 changes: 7 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 1.30.0-beta
=============
- Replace org.projectlombok dependencies with implementations of generated code (#946)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention about breaking changes from exception changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we just make a separate changelog/version update PR once everything is merged to clearly mark the cutoff for changes that we release, so I didn't include them here

But this is kind of a special case due to it already being released. I just set up this PR to make it easier to review the changelog, and will either merge into this branch or the main branch depending on which gets approved first: #983

- Replace com.nimbusds dependencies with implementations of OAuth behavior (#926, #927, #928, #941, #945)
- Replace com.fasterxml.jackson with com.azure.json for JSON behavior (#947, #948)

Version 1.22.0
=============
- Validate issuer from OIDC endpoint when using the oidcAuthority() API (#970)
Expand All @@ -11,7 +17,7 @@ Version 1.21.0
- Fix query parameter issue in IMDS scenarios (#954)
- Update dependencies used in tests to avoid CVE warnings (#962)

Version 1.20.1
1.20.1
=============
- Fix Base64URL decoding bug (#938)

Expand Down
6 changes: 3 additions & 3 deletions msal4j-sdk/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.22.0
Current version - 1.30.0-beta

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.22.0</version>
<version>1.30.0-beta</version>
</dependency>
```
### Gradle

```gradle
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.22.0'
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.30.0-beta'
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion msal4j-sdk/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Export-Package: com.microsoft.aad.msal4j;version="1.22.0"
Export-Package: com.microsoft.aad.msal4j;version="1.30.0-beta"
Automatic-Module-Name: com.microsoft.aad.msal4j
124 changes: 43 additions & 81 deletions msal4j-sdk/pom.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.22.0</version>
<packaging>jar</packaging>
<name>msal4j</name>
<description>
Microsoft Authentication Library for Java gives you the ability to obtain tokens from Microsoft Entra (work and
school accounts, MSA) and Azure AD B2C, gaining access to Microsoft Cloud API and any other API secured by Microsoft
identities
</description>
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
<developers>
<developer>
<id>msopentech</id>
<name>Microsoft Open Technologies, Inc.</name>
</developer>
</developers>
<licenses>
<license>
<name>MIT License</name>
</license>
</licenses>
<inceptionYear>2013</inceptionYear>
<scm>
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
</scm>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.30.0-beta</version>
<packaging>jar</packaging>
<name>msal4j</name>
<description>
Microsoft Authentication Library for Java gives you the ability to obtain tokens from Azure AD v2 (work and school
accounts, MSA) and Azure AD B2C, gaining access to Microsoft Cloud API and any other API secured by Microsoft
identities
</description>
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
<developers>
<developer>
<id>msopentech</id>
<name>Microsoft Open Technologies, Inc.</name>
</developer>
</developers>
<licenses>
<license>
<name>MIT License</name>
</license>
</licenses>
<inceptionYear>2013</inceptionYear>
<scm>
<url>https://github.com/AzureAD/microsoft-authentication-library-for-java</url>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -39,45 +39,30 @@
</properties>

<dependencies>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
<version>11.23.1</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.18.1</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
<version>11.23</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down Expand Up @@ -167,7 +152,7 @@
</pluginRepositories>

<build>
<sourceDirectory>${project.build.directory}/delombok</sourceDirectory>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.revapi</groupId>
Expand Down Expand Up @@ -198,30 +183,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.20.0</version>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>src/main/java</sourceDirectory>
<outputDirectory>${project.build.directory}/delombok</outputDirectory>
<addOutputDirectory>false</addOutputDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand Down Expand Up @@ -250,7 +212,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<sourcepath>${project.build.directory}/delombok</sourcepath>
<sourcepath>src/main/java</sourcepath>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,42 +212,6 @@ private IAuthenticationResult acquireTokenSilently(IPublicClientApplication pca,
.get();
}

public void acquireTokensInHomeAndGuestClouds(String homeCloud) throws MalformedURLException {

User user = labUserProvider.getUserByGuestHomeAzureEnvironments
(AzureEnvironment.AZURE, homeCloud);

// use user`s upn from home cloud
user.setUpn(user.getHomeUPN());

ITokenCacheAccessAspect persistenceAspect = new ITokenCacheAccessAspect() {
String data;

@Override
public void beforeCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext) {
iTokenCacheAccessContext.tokenCache().deserialize(data);
}

@Override
public void afterCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext) {
data = iTokenCacheAccessContext.tokenCache().serialize();
}
};

PublicClientApplication publicCloudPca = PublicClientApplication.builder(
user.getAppId()).
authority(TestConstants.AUTHORITY_PUBLIC_TENANT_SPECIFIC).setTokenCacheAccessAspect(persistenceAspect).
build();

IAuthenticationResult result = acquireTokenInteractive(user, publicCloudPca, TestConstants.USER_READ_SCOPE);
IntegrationTestHelper.assertAccessAndIdTokensNotNull(result);
assertEquals(user.getHomeUPN(), result.account().username());

publicCloudPca.removeAccount(publicCloudPca.getAccounts().join().iterator().next()).join();

assertEquals(publicCloudPca.getAccounts().join().size(), 0);
}

private IAuthenticationResult acquireTokenInteractive(
User user,
PublicClientApplication pca,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
// Licensed under the MIT License.
package com.microsoft.aad.msal4j;

import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.PlainJWT;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Collections;

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class CachePersistenceIT {

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

@Test
void cacheDeserializationSerializationTest() throws IOException, URISyntaxException {
void cacheDeserializationSerializationTest() {
String dataToInitCache = TestHelper.readResource(this.getClass(), "/cache_data/serialized_cache.json");

String ID_TOKEN_PLACEHOLDER = "<idToken_placeholder>";
JWTClaimsSet claimsSet = new JWTClaimsSet.Builder()
.audience(Collections.singletonList("jwtAudience"))
.issuer("issuer")
.subject("subject")
.build();
PlainJWT jwt = new PlainJWT(claimsSet);

dataToInitCache = dataToInitCache.replace(ID_TOKEN_PLACEHOLDER, jwt.serialize());
dataToInitCache = dataToInitCache.replace("<idToken_placeholder>", TestHelper.ENCODED_JWT);

ITokenCacheAccessAspect persistenceAspect = new TokenPersistence(dataToInitCache);

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

assertEquals(app.getAccounts().join().size(), 1);
assertEquals(app.tokenCache.accounts.size(), 1);
assertEquals(app.tokenCache.accessTokens.size(), 2);
assertEquals(app.tokenCache.refreshTokens.size(), 1);
assertEquals(app.tokenCache.idTokens.size(), 1);
assertEquals(app.tokenCache.appMetadata.size(), 1);
assertEquals(1, app.getAccounts().join().size());
assertEquals(1, app.tokenCache.accounts.size());
assertEquals(1, app.tokenCache.accessTokens.size());
assertEquals(1, app.tokenCache.refreshTokens.size());
assertEquals(1, app.tokenCache.idTokens.size());
assertEquals(1, app.tokenCache.appMetadata.size());

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

assertEquals(app.getAccounts().join().size(), 1);
assertEquals(app.tokenCache.accounts.size(), 1);
assertEquals(app.tokenCache.accessTokens.size(), 2);
assertEquals(app.tokenCache.refreshTokens.size(), 1);
assertEquals(app.tokenCache.idTokens.size(), 1);
assertEquals(app.tokenCache.appMetadata.size(), 1);
assertEquals(1, app.getAccounts().join().size());
assertEquals(1, app.tokenCache.accounts.size());
assertEquals(1, app.tokenCache.accessTokens.size());
assertEquals(1, app.tokenCache.refreshTokens.size());
assertEquals(1, app.tokenCache.idTokens.size());
assertEquals(1, app.tokenCache.appMetadata.size());

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

assertEquals(app.getAccounts().join().size(), 0);
assertEquals(app.tokenCache.accounts.size(), 0);
assertEquals(app.tokenCache.accessTokens.size(), 1);
assertEquals(app.tokenCache.refreshTokens.size(), 0);
assertEquals(app.tokenCache.idTokens.size(), 0);
assertEquals(app.tokenCache.appMetadata.size(), 1);
assertEquals(0, app.getAccounts().join().size());
assertEquals(0, app.tokenCache.accounts.size());
assertEquals(0, app.tokenCache.accessTokens.size());
assertEquals(0, app.tokenCache.refreshTokens.size());
assertEquals(0, app.tokenCache.idTokens.size());
assertEquals(1, app.tokenCache.appMetadata.size());

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

assertEquals(app.getAccounts().join().size(), 0);
assertEquals(app.tokenCache.accounts.size(), 0);
assertEquals(app.tokenCache.accessTokens.size(), 1);
assertEquals(app.tokenCache.refreshTokens.size(), 0);
assertEquals(app.tokenCache.idTokens.size(), 0);
assertEquals(app.tokenCache.appMetadata.size(), 1);
assertEquals(0, app.getAccounts().join().size());
assertEquals(0, app.tokenCache.accounts.size());
assertEquals(0, app.tokenCache.accessTokens.size());
assertEquals(0, app.tokenCache.refreshTokens.size());
assertEquals(0, app.tokenCache.idTokens.size());
assertEquals(1, app.tokenCache.appMetadata.size());
}
}
Loading
Loading