azure-sdk-for-java: [BUG] Version problem about nimbus-jose-jwt in azure-active-directory-spring-boot-starter

Describe the bug When starting up an app with the azure-active-directory-spring-boot-starter, it fails with an error about calling a method that does not exist.

Exception or Stack Trace

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    com.microsoft.azure.spring.autoconfigure.aad.AADAuthenticationFilterAutoConfiguration.getJWKSetCache(AADAuthenticationFilterAutoConfiguration.java:101)

The following method did not exist:

    com/nimbusds/jose/jwk/source/DefaultJWKSetCache.<init>(JLjava/util/concurrent/TimeUnit;)V

The method's class, com.nimbusds.jose.jwk.source.DefaultJWKSetCache, is available from the following locations:

    jar:file:/Users/azuroff/.m2/repository/com/nimbusds/nimbus-jose-jwt/8.13/nimbus-jose-jwt-8.13.jar!/com/nimbusds/jose/jwk/source/DefaultJWKSetCache.class

The class hierarchy was loaded from the following locations:

    com.nimbusds.jose.jwk.source.DefaultJWKSetCache: file:/Users/azuroff/.m2/repository/com/nimbusds/nimbus-jose-jwt/8.13/nimbus-jose-jwt-8.13.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.nimbusds.jose.jwk.source.DefaultJWKSetCache

To Reproduce Steps to reproduce the behavior:

Include the azure-active-directory-spring-boot-starter and a version of nimbus-jose-jwt greater than 8.9. The constructor being called was changed in version 8.10.

Code Snippet Add the code snippet that causes the issue.

N/A - internal library code

Expected behavior A clear and concise description of what you expected to happen.

The app should start up without errors.

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: [e.g. iOS] - MacOS Catalina 10.15.6
  • IDE : [e.g. IntelliJ] - IntelliJ IDEA 2020.2.1
  • Version of the Library used

azure-active-directory-spring-boot-starter - 2.3.3 nimbus-jose-jwt - > 8.9

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 31 (16 by maintainers)

Commits related to this issue

Most upvoted comments

We released azure-spring-boot-starter-active-directory:3.0.0, so I’ll close this issue.

Also, for users: If you want to use a newer version of spring-boot-starter before this update takes effect, add the following snippet to your any configuration:

@Autowired
private AADAuthenticationProperties aadAuthProps;
//other configs...

@Bean
public JWKSetCache getJWKSetCache () {
    long lifeSpan = aadAuthProps.getJwkSetCacheLifespan();
    return new DefaultJWKSetCache (lifeSpan, lifeSpan, TimeUnit.MILLISECONDS);
}

This is the same behavior as nimbus-jose-jwt <8.10. However, it is desirable that the second argument be slightly smaller than the first argument, as it can cause other problems as pointed out earlier.

I hope you find it useful.

Hi, @tschmidt01 , Thank you for reaching out.

I think if you change spring-boot-starter-parent’s version from 2.3.4.RELEASE to 2.3.3.RELEASE will solve your problem.


Here is the detail information:

pom(spring-boot-starter-parent-2.3.3.RELEASE)(azure.version=2.3.5).xml.txt

image


pom(spring-boot-starter-parent-2.3.3.RELEASE)(azure.version=2.3.5).xml.txt

image


Currently, our azure-active-directory-spring-boot-starter not fit spring-boot-2.3.4 well.

I create a issue to fix it: https://github.com/Azure/azure-sdk-for-java/issues/15666