I am validating a saml token using thumbprint and want to set the expiry value of oauth token as per the saml token that is being validated.
I was able to get the value in seconds, but the oauth policy is not accepting the vaiable in the expires_in field.
I tried to pass the variable in the below ways.
<ExpiresIn><Ref>saml_sessionLength</Ref></ExpiresIn>
<ExpiresIn>saml_sessionLength</ExpiresIn>
<ExpiresIn>{saml_sessionLength}</ExpiresIn>
<ExpiresIn ref="saml_sessionLength"/>
Error :
Error creating object
Error occurred while validation of bean OA_GenerateAccessTokenSAML.xml. Reason: - Schema validation failed. Cause : For input string: ''. Line number : 8. Column number : 14. File name : OA_GenerateAccessTokenSAML.xml..
According to docs http://docs.apigee.com/api-services/content/oauthv2-policy#expiresinelement
I can see the expires_in can be set using a flow variable.
only thing that seems to be missing from above is the default value from the sntax.
Can you put in that and try?
<ExpiresIn ref="flow.variable"> {default_value} </ExpiresIn>
I did not try it on my side though
The expiry time can also be set at runtime using a reference to a flow variable or it can be hard-coded.
E.g. In the below configuration, expiresIn is set from with the value specified in the query param "expires_in". If this value is not specified then it's set as 1000 milli seconds by default.
<ExpiresIn ref="request.queryparam.expires_in">1000</ExpiresIn>
Please note that the flow variable value takes precedence over the specified default value.
getting this error "java.lang.Long cannot be cast to java.lang.String" when trying to set expires_in from a flow variable.
<ExpiresIn ref="oauthTokenExpiresin">360000000</ExpiresIn>
Just make the value a smaller one instead of so big. Try as 3600000
This works if we set the type for extract variable.
<Variable name="oauthTokenExpiresin" type="string">
Seems like error is due to some other reason. Do you still see this issue ?
The trap is even if the variable is null the defautl value is not taken in account .
The best way is to set the variable before the token generation...
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |