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 b98e86ee..ff1d78aa 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 @@ -77,8 +77,11 @@ public void setCookie(JsServletResponse response, String name, Object... params) if (sign) { try { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - signature = Base64.encode(IdentityUtil.signWithTenantKey(value, tenantDomain)); - } catch (Exception e) { + // 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() + .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); return; } diff --git a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/internal/HTTPFunctionsServiceComponent.java b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/internal/HTTPFunctionsServiceComponent.java index 1dccb227..3040555e 100644 --- a/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/internal/HTTPFunctionsServiceComponent.java +++ b/components/org.wso2.carbon.identity.conditional.auth.functions.http/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/http/internal/HTTPFunctionsServiceComponent.java @@ -127,6 +127,6 @@ public void setIdentityKeyStoreGenerator(IdentityKeyStoreGenerator identityKeySt public void unsetIdentityKeyStoreGenerator(IdentityKeyStoreGenerator identityKeyStoreGenerator) { - HTTPFunctionsServiceHolder.getInstance().setIdentityKeyStoreGenerator(identityKeyStoreGenerator); + HTTPFunctionsServiceHolder.getInstance().setIdentityKeyStoreGenerator(null); } } diff --git a/pom.xml b/pom.xml index acd4bcb3..b9f09877 100644 --- a/pom.xml +++ b/pom.xml @@ -528,7 +528,7 @@ 4.10.22 [4.6.0, 5.0.0) [1.0.1, 2.0.0) - 7.7.23 + 7.7.34 1.0.89 5.20.447 [5.14.0, 8.0.0)