Problem while testing sample spring-cloud-azure-starter-active-directory-resource-server
cheikh-diop opened this issue · 2 comments
Azure AD Spring Cloud Starter Resource Server #666
Hello guys,
I have a Spring REST application backend. I am using JWT Auth0 to secure my application.
Now I want to have a possibility to connect with Azure AD, and to enable token verification on controller without scope definition on controller
Through this git repo, I created my application on https://portal.azure.com/, added the dependencies, but my problem is that I can't configure the security part with Spring Security since I choose to add extra security configurations to only authorize Authenticated Request
`
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class AadOAuth2LoginSecurityConfig extends AadWebSecurityConfigurerAdapter {
@OverRide
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
http.authorizeRequests()
.anyRequest().authenticated();
// Do some custom configuration
}
}
`
Here is the application.yml:
`
spring:
cloud:
azure:
active-directory:
enabled: true
credential:
client-id: client-id
session-stateless: true
app-id-uri: ${APP_ID_URI}
`
I got the following error on startup:
java.lang.IllegalStateException: Unable to load cache item at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:79) ~[spring-core-5.3.26.jar:5.3.26] at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.3.26.jar:5.3.26] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[spring-................................. .................... Caused by: java.lang.NoClassDefFoundError: org/springframework/security/oauth2/client/endpoint/OAuth2AccessTokenResponseClient
Hi @cheikh-diop , thanks for using Spring Cloud Azure.
It seems you are using the spring-security-oauth2-client
dependency, the resource server you mentioned sample does not need this one, please check your POM file configuration, see more from the Get Started doc
thanks you my problem is resolved