From 2b04eef2d59ee7c8cc76f4882c81e82efa0e7564 Mon Sep 17 00:00:00 2001 From: thumimku Date: Wed, 11 Dec 2024 15:36:36 +0530 Subject: [PATCH] address comments --- .../conditional/auth/functions/http/CookieFunctionImpl.java | 4 ---- .../auth/functions/http/GetCookieFunctionImpl.java | 4 ---- .../auth/functions/http/SetCookieFunctionImpl.java | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/CookieFunctionImpl.java b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/CookieFunctionImpl.java index d6f97f92..b98e86ee 100644 --- a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/CookieFunctionImpl.java +++ b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/CookieFunctionImpl.java @@ -188,10 +188,6 @@ public String getCookieValue(JsServletRequest request, Object... params) { try { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); - // For getCookie, setCookie functionalities tenant shouldn't use its tenanted keystore. - // Hence, below code will create a keystore for this context if not exists. - HTTPFunctionsServiceHolder.getInstance().getIdentityKeyStoreGenerator() - .generateKeyStoreIfNotExists(tenantDomain, KEY_STORE_CONTEXT); boolean isValid = IdentityUtil.validateSignatureFromTenant(valueString, signature, tenantDomain, KEY_STORE_CONTEXT); if (!isValid) { diff --git a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/GetCookieFunctionImpl.java b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/GetCookieFunctionImpl.java index 803a13f3..e5cdca4e 100644 --- a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/GetCookieFunctionImpl.java +++ b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/GetCookieFunctionImpl.java @@ -106,10 +106,6 @@ public String getCookieValue(JsServletRequest request, Object... params) { try { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); - // For getCookie, setCookie functionalities tenant shouldn't use its tenanted keystore. - // Hence, below code will create a keystore for this context if not exists. - HTTPFunctionsServiceHolder.getInstance().getIdentityKeyStoreGenerator() - .generateKeyStoreIfNotExists(tenantDomain, KEY_STORE_CONTEXT); boolean isValid = IdentityUtil.validateSignatureFromTenant(valueString, signature, tenantDomain, KEY_STORE_CONTEXT); if (!isValid) { diff --git a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/SetCookieFunctionImpl.java b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/SetCookieFunctionImpl.java index 3be8c7fc..d31779b8 100644 --- a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/SetCookieFunctionImpl.java +++ b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/SetCookieFunctionImpl.java @@ -74,7 +74,7 @@ public void setCookie(JsServletResponse response, String name, Object... params) // For getCookie, setCookie functionalities tenant shouldn't use its tenanted keystore. // Hence, below code will create a keystore for this context if not exists. HTTPFunctionsServiceHolder.getInstance().getIdentityKeyStoreGenerator() - .generateKeyStoreIfNotExists(tenantDomain, KEY_STORE_CONTEXT); + .generateKeyStore(tenantDomain, KEY_STORE_CONTEXT); signature = Base64.encode(IdentityUtil.signWithTenantKey(value, tenantDomain, KEY_STORE_CONTEXT)); } catch (Exception e) { log.error("Error occurred when signing the cookie value.", e);