From 6b67958f5220ff58ff84fc2e44fc7890d6c48b6f Mon Sep 17 00:00:00 2001 From: Jack Lu Date: Thu, 29 Oct 2020 14:49:52 +0800 Subject: [PATCH 1/2] Modify keyvault template to soft delete Signed-off-by: Jack Lu --- .../azure-spring-boot-test-keyvault/test-resources.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json b/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json index fab78b36615dc..02a04b349944f 100644 --- a/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json +++ b/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json @@ -313,8 +313,7 @@ ], "enabledForDeployment": false, "enabledForDiskEncryption": false, - "enabledForTemplateDeployment": false, - "enableSoftDelete": false + "enabledForTemplateDeployment": false } }, { @@ -363,8 +362,7 @@ ], "enabledForDeployment": false, "enabledForDiskEncryption": false, - "enabledForTemplateDeployment": false, - "enableSoftDelete": false + "enabledForTemplateDeployment": false } }, { From a569350c9c60aa7c6386bc1ea4465fba75170a5d Mon Sep 17 00:00:00 2001 From: Jack Lu Date: Mon, 16 Nov 2020 15:37:01 +0800 Subject: [PATCH 2/2] fixes #17567 --- .../AADAuthenticationFilterAutoConfiguration.java | 3 ++- .../aad/AADAuthenticationProperties.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterAutoConfiguration.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterAutoConfiguration.java index 1bc4c26626f27..05489f4fd1f9d 100644 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterAutoConfiguration.java +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterAutoConfiguration.java @@ -109,7 +109,8 @@ public ResourceRetriever getJWTResourceRetriever() { @ConditionalOnMissingBean(JWKSetCache.class) public JWKSetCache getJWKSetCache() { long lifespan = aadAuthenticationProperties.getJwkSetCacheLifespan(); - return new DefaultJWKSetCache(lifespan, lifespan, TimeUnit.MILLISECONDS); + long refreshTime = aadAuthenticationProperties.getJwkSetCacheRefreshTime(); + return new DefaultJWKSetCache(lifespan, refreshTime, TimeUnit.MILLISECONDS); } @PostConstruct diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationProperties.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationProperties.java index f1dbcd56948f4..bb3e5d32070e1 100644 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationProperties.java +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/AADAuthenticationProperties.java @@ -33,6 +33,7 @@ public class AADAuthenticationProperties { private static final Logger LOGGER = LoggerFactory.getLogger(AADAuthenticationProperties.class); private static final String DEFAULT_SERVICE_ENVIRONMENT = "global"; private static final long DEFAULT_JWK_SET_CACHE_LIFESPAN = TimeUnit.MINUTES.toMillis(5); + private static final long DEFAULT_JWK_SET_CACHE_REFRESH_TIME = DEFAULT_JWK_SET_CACHE_LIFESPAN; private static final String GROUP_RELATIONSHIP_DIRECT = "direct"; private static final String GROUP_RELATIONSHIP_TRANSITIVE = "transitive"; @@ -101,6 +102,11 @@ public class AADAuthenticationProperties { */ private long jwkSetCacheLifespan = DEFAULT_JWK_SET_CACHE_LIFESPAN; + /** + * The refresh time of the cached JWK set before it expires, default is 5 minutes. + */ + private long jwkSetCacheRefreshTime = DEFAULT_JWK_SET_CACHE_REFRESH_TIME; + /** * Azure Tenant ID. */ @@ -388,6 +394,14 @@ public void setJwkSetCacheLifespan(long jwkSetCacheLifespan) { this.jwkSetCacheLifespan = jwkSetCacheLifespan; } + public long getJwkSetCacheRefreshTime() { + return jwkSetCacheRefreshTime; + } + + public void setJwkSetCacheRefreshTime(long jwkSetCacheRefreshTime) { + this.jwkSetCacheRefreshTime = jwkSetCacheRefreshTime; + } + public String getTenantId() { return tenantId; }