Skip to content
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

Added check for MSAL library when attempting ActiveDirectoryServicePrincipal authentication #1759

Merged
merged 1 commit into from
Mar 3, 2022

Conversation

caseyhall
Copy link
Contributor

Minor change. This check exists for other AD auth cases, but will just throw java.lang.ClassNotFoundException if ActiveDirectoryServicePrincipal is used and MSAL libraries are not in the classpath. In another project, I had spent some time trying to determine the issue, only to notice this missing check would have been helpful.

This just adds the check used in other AD auth cases to the ActiveDirectoryServicePrincipal case.

Caused by: java.lang.NoClassDefFoundError: com/microsoft/aad/msal4j/IClientCredential
at com.microsoft.sqlserver.jdbc.SQLServerConnection.getFedAuthToken(SQLServerConnection.java:5341)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.onFedAuthInfo(SQLServerConnection.java:5293)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.processFedAuthInfo(SQLServerConnection.java:5180)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onFedAuthInfo(tdsparser.java:305)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:128)

now returns:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Failed to load MSAL4J Java library for performing ActiveDirectoryServicePrincipal authentication.
at com.microsoft.sqlserver.jdbc.SQLServerConnection.getFedAuthToken(SQLServerConnection.java:5333)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.onFedAuthInfo(SQLServerConnection.java:5290)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.processFedAuthInfo(SQLServerConnection.java:5177)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onFedAuthInfo(tdsparser.java:305)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:128)

Thanks

@Jeffery-Wasty
Copy link
Contributor

Thank you for the contribution @caseyhall. We'll take a look and get back to you.

@lilgreenbird lilgreenbird added this to the 10.3.0 milestone Mar 3, 2022
@lilgreenbird lilgreenbird merged commit 8806c17 into microsoft:main Mar 3, 2022
@lilgreenbird lilgreenbird changed the title Add check for MSAL library when attempting ActiveDirectoryServicePrincipal authentication Added check for MSAL library when attempting ActiveDirectoryServicePrincipal authentication Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants