Describe the bug
When user configures the below properties:
spring.cloud.azure.active-directory.jwk-set-cache-lifespan: xxx
spring.cloud.azure.active-directory.jwk-set-cache-refresh-time: xxx
The configured JWK set cache is not applied for below beans:
- AadAppRoleStatelessAuthenticationFilter
|
@Bean |
|
@ConditionalOnMissingBean(AadAppRoleStatelessAuthenticationFilter.class) |
|
@ConditionalOnExpression("${spring.cloud.azure.active-directory.session-stateless:false} == true") |
|
AadAppRoleStatelessAuthenticationFilter aadStatelessAuthFilter(ResourceRetriever resourceRetriever) { |
|
LOGGER.info("Creating AadStatelessAuthFilter bean."); |
|
return new AadAppRoleStatelessAuthenticationFilter( |
|
new UserPrincipalManager( |
|
endpoints, |
|
properties, |
|
resourceRetriever, |
|
true |
|
) |
|
); |
|
} |
|
keySource = new RemoteJWKSet<>(new URL(jwkSetEndpoint), resourceRetriever); |
https://github.com/spring-projects/spring-security/blob/2cc6cbdb77d761cdfc7d792bb2d772c2b9186e93/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java#L379-L397
Exception or Stack Trace
Will always use the default cache value. Check the url access frequency.

To Reproduce
Use sample aad-resource-server-by-filter-stateless and aad-web-application-and-resource-server.
Code Snippet
N/A
Expected behavior
Apply the user configured jwk set cache.
Screenshots
If applicable, add screenshots to help explain your problem.
Setup (please complete the following information):
- Library/Libraries: spring-cloud-azure-starter-active-directory:5.14.0
- Java version: Java 17
If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:
- verbose dependency tree (
mvn dependency:tree -Dverbose)
- exception message, full stack trace, and any available logs
Additional context
N/A
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
Describe the bug
When user configures the below properties:
The configured JWK set cache is not applied for below beans:
azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/aad/configuration/AadAuthenticationFilterAutoConfiguration.java
Lines 74 to 87 in 8c9ea1a
azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/aad/filter/UserPrincipalManager.java
Line 97 in 8c9ea1a
https://github.com/spring-projects/spring-security/blob/2cc6cbdb77d761cdfc7d792bb2d772c2b9186e93/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java#L379-L397
Exception or Stack Trace

Will always use the default cache value. Check the url access frequency.
To Reproduce
Use sample aad-resource-server-by-filter-stateless and aad-web-application-and-resource-server.
Code Snippet
N/A
Expected behavior
Apply the user configured jwk set cache.
Screenshots
If applicable, add screenshots to help explain your problem.
Setup (please complete the following information):
If you suspect a dependency version mismatch (e.g. you see
NoClassDefFoundError,NoSuchMethodErroror similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:mvn dependency:tree -Dverbose)Additional context
N/A
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