I configured an OAuth2 client on Gravitee AM to secure access to an API and it works fine.
I would like to be able to add a variable in the headers (using the Transform Header Policy) that appears in the metadata of the AM client.
My metadata is called "app_code", I tried to call the variable with the following expression:
{#jsonPath( #context.attributes['oauth.payload'], '$.app_code' ) }
but it returns nothing.
However, the expression below does return the client id:
{#jsonPath( #context.attributes['oauth.payload'], '$.client_id' ) }
I checked the "payload extraction" box, that the variable was declared for the right client, etc...
I tried the language expressions below:
1/ What does not return "null":
{#jsonPath( #context.attributes['oauth.payload'], '$.client_id' ) }
{#context.attributes['application']}
{#context.attributes['user_id']}
2/ All the expressions below return "null":
{#jsonPath( #context.attributes['oauth.payload'], '$.app_code' ) }
{#jsonPath( #context.attributes['oauth.payload'], '$.metadata.app_code' ) }
{#jsonPath( #context.attributes['oauth.payload'], '$.metadata' ) }
{#jsonPath( #context.attributes['application'], '$.app_code' ) }
{#jsonPath( #context.attributes['application'], '$.metadata.app_code')}
{#context.attributes['application']['metadata']['app_code'])}
{#context.attributes['app_code']}
{#jsonPath( #context.attributes['client'], '$.app_code' ) }
{#context.attributes['client']['metadata']['app_code']}
{#context.attributes['client']['app_code'] }
In AM's application metadata management page, there is this sentence:
"You can add custom information to your application and retrieve them via the client.metadata execution context value."
is it incompatible with OAuth2 ?
(Gravitee Api Manager and Gravitee Access Manager are in version 3.16)