My application has some encrypted cookies with dynamic names. I have implemented the middleware for encryption and it is working fine for those cookies with static names such as xxx, yyy and zzz.
$cookiesEncrypted = new EncryptedCookieMiddleware(
// Names of cookies to protect
[
'xxx','yyy','zzz'
],
Configure::read('Security.cookieKey')
);
$middlewareQueue->add($cookiesEncrypted)
However, I'm not sure how exactly could I encrypt the cookies with the dynamic names. For example, if my cookie name is '3HA8_settings', where the prefix 3HA8 is some product id, how do I declare or access the cookie name inside my Application.php for encryption.
Can anybody throw some light on how this could be achieved?
As suggested previously, I had read through the middleware links provided below but it doesn't really help me with the above issue. I must have miss out something somewhere.