Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to create dynamic cache using PopulateCache policy with KeyFragment

Requirement: We have to dynamically cache credentials based on the developer app calling the proxy.

Below configuration works in a normal scenarios where credentials are same for all developer apps. but our scenario is credentials will change based for each developer app calling the proxy.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="PopulateCachesecretKey">
    <DisplayName>PopulateCacheSecrets</DisplayName>
    <CacheKey>
        <KeyFragment>SnowProxy-Vault-Secrets</KeyFragment>
    </CacheKey>
    <Scope>Target</Scope>
    <ExpirySettings>
        <TimeoutInSec>86400</TimeoutInSec>
    </ExpirySettings>
    <Source>vaultData</Source>
</PopulateCache>

I have tried something like this below but the caching does not work, It's going to vault to get credentials for each call.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="PopulateCachesecretKey">
    <DisplayName>PopulateCacheSecrets</DisplayName>
    <CacheKey>
        <KeyFragment>Proxy-Vault-Secrets</KeyFragment>
        <KeyFragment ref="jwt.Decode-JWT-1.claim.appid"/>
    </CacheKey>
    <Scope>Target</Scope>
    <ExpirySettings>
        <TimeoutInSec>86400</TimeoutInSec>
    </ExpirySettings>
    <Source>vaultData</Source>
</PopulateCache>

Anyone have any examples how to make the caching unique to the developer app dynamically?

0 2 368
2 REPLIES 2