AzureAD / microsoft-authentication-library-for-java

Microsoft Authentication Library (MSAL) for Java http://aka.ms/aadv2
MIT License
284 stars 142 forks source link

Resolving Maven Dependency for MSAL4J #727

Closed Kiranmohancse closed 10 months ago

Kiranmohancse commented 10 months ago

Library version used

1.13.10

Java version

11

Scenario

ConfidentialClient - web site (AcquireTokenByAuthCode)

Is this a new or an existing app?

This is a new app or experiment

Issue description and reproduction steps

I am trying to integrate MSAL4J with AEM (Adobe Experience Manager) and facing issue with resolving the run time dependency. What is the right way to use MSAL4J jar and include all the dependencies there.

I have tried adding Export-Package and Import-Package in my pom.xml but it keeps on giving me more & more dependencies issue

My pom.xml

Import-Package: javax.annotation;version=0.0.0,* Export-Package: com.microsoft.aad.msal4j;version=1.13.10;uses:=com.fasterxml.jackson.annotation,com.nimbusds.oauth2.sdk.auth,com.nimbusds.oauth2.sdk.http,com.nimbusds.oauth2.sdk.id,javax.net.ssl,org.slf4j

Error - commoncore:1.0.0-SNAPSHOT is importing package(s) [jakarta.servlet.http, com.nimbusds.oauth2.sdk, com.sun.net.httpserver, com.nimbusds.jose.util, com.nimbusds.common.contenttype, com.nimbusds.oauth2.sdk.util, com.nimbusds.jose.crypto, org.slf4j.impl, jakarta.servlet, com.nimbusds.oauth2.sdk.assertions.jwt, com.nimbusds.openid.connect.sdk, com.nimbusds.openid.connect.sdk.token, net.minidev.json, com.nimbusds.jwt, net.jcip.annotations, com.nimbusds.jose, com.nimbusds.oauth2.sdk.pkce, com.nimbusds.oauth2.sdk.token, com.nimbusds.jose.crypto.utils] in start level 20 but no bundle is exporting these for that start level. (com.msft:msft.all:1.0.0-SNAPSHOT)

Relevant code snippets

No response

Expected behavior

No response

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

Avery-Dunn commented 10 months ago

Hello @Kiranmohancse : I'm not familiar with Adobe Experience Manager, however after a quick search this seems to be a common issue that people face when using AEM, and has to do with how dependencies are defined in the various pom.xml files in an AEM project.

Unless the msal4j package is the only one causing this error then there likely isn't much support we can give, and you'd be more likely to get help by asking on the AEM community site: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/bd-p/adobe-experience-manager-qanda

We're always happy to write documentation on how to get MSAL Java working in specific frameworks if there are some unique or unintuitive steps involved, but outside of specific samples for those frameworks we want to avoid any sort of generic product instructions.

Kiranmohancse commented 10 months ago

You are correct. But can i get all the dependencies that is required for MSAL4J (transitive also) so that i can add that in my pom.xml

bgavrilMS commented 10 months ago

Sure - https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/dev/msal4j-sdk/pom.xml - see that most dependencies are for tests.

Avery-Dunn commented 10 months ago

Closing due to inactivity. If you're still having issues or have any related questions, feel free to re-open this thread or start a new one.