Issue while retrieving data from Lookup cache because of SAMLAssertion

Not applicable

Hi,

I am passing SAML Assertion in the header of the request which size is 5.97 KB and With the reference of the SAML Assertion caching the value of the User ID in the populate cache. Then Using Lookup Tried to retrieve the User ID with the ref of the SAML assertion. But unable to retrieve because of Size of the Assertion or size of the cache not sure why so can you please suggest me what i can try to get the UserID from the Cache. Thank you for you help in advance.

0 4 305
4 REPLIES 4

Hi, I'm sorry to hear you're having trouble. Let's see if I can help.

You wrote:

unable to retrieve because of Size of the Assertion or size of the cache not sure why

I understand this: the results of the LookupCache policy are not what you expect.

Can you show the exact XML configuration of the PopulateCache and LookupCache policies? When you post the code, please use the code formatting button to make it easier on our eyes:

5701-click-for-code-formatting.png

Also: What is the value of the expiry on the cached element? And how much time elapses between the execution of the PopulateCache and the LookupCache? Have you checked that the expiry is set correctly?

I understand that you want to perform the LookupCache LATER, after some time has elapsed. But for diagnostic purposes, Have you tried placing a copy of your LookupCache policy directly after the PopulateCache policy, to see if it retrieves the expected value immediately after the PopulateCache executes? If not, can you try that?

You have suggested that the problem is somehow related to a SAML assertion. I understand that you are trying to cache a SAML assertion, or a part of a SAML Assertion. But are you sure that the value you are caching is the cause of the problem? For testing purposes, can you simplify the scenario and try to cache a simple value, like "Meenap" ? After you are able to cache a simple value, you can move to the more complex scenario.

Not applicable
Hi Dino,

 300s is the cache expiration time.There is not much elapse time it is just next call.

 I cached a simple value and it is executing as expected, but if it is more length then there is a failure.

 I checked keeping the lookup cache next to populate as well.same issue because of length of the saml. If I pass small portions from the token it is passing, but if i try to   send the full token it is failing  and able to see the full token which i passed in the header that i am able to see in the trace but i am not able to retrieve the value from the cache.

Lookup cache policy:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache async="false" continueOnError="false" enabled="true" name="Lookup-Cache-3">
    <DisplayName>Lookup Cache-3</DisplayName>
    <Properties/>
    <CacheKey>
        <Prefix/>
        <KeyFragment ref="request.header.SAMLToken"/>
    </CacheKey>
    <CacheResource>UserSAML</CacheResource>
    <Scope>Application</Scope>
    <AssignTo>VarSAMLUser</AssignTo>
</LookupCache>

PopulateCache Policy:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="Populate-Cache-3">
    <DisplayName>Populate Cache-3</DisplayName>
    <Properties/>
    <CacheKey>
        <Prefix/>
        <KeyFragment ref="request.header.SAMLToken"/>
    </CacheKey>
    <CacheResource>UserSAML</CacheResource>
    <Scope>Application</Scope>
    <ExpirySettings>
        <TimeoutInSec>300</TimeoutInSec>
    </ExpirySettings>
    <Source>request.header.UserID</Source>
</PopulateCache>


This is a reply provided to dino. This is not a answer i drafted it wrong box..

I have the same problem and found out that the base64 encoded SAML assertion is too large due the cache value size limitations:

https://docs.apigee.com/api-platform/cache/cache-internals#cachelimits