Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIImportApp ERROR: Invalid Oauth token info policy #477

Open
gfonteneau opened this issue Apr 5, 2024 · 1 comment
Open

APIImportApp ERROR: Invalid Oauth token info policy #477

gfonteneau opened this issue Apr 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@gfonteneau
Copy link

gfonteneau commented Apr 5, 2024

APIM-CLI version

1.14.4

API-Management version

7.7.0.20240228

Bug description

we try to deploy an api with an "OAuth Token Information Policy".
The deploy work fine in apim-cli 1.13.6 to an apim 7.7.0.20240228 but we got an error with apim-cli 1.14.4

Steps to reproduce

in our api json we have a security Profiles :

"securityProfiles": [
   {
     "name": "_default",
     "isDefault": true,
     "devices": [
       {
         "type": "oauthExternal",
         "name": "OAuth (External)",
         "order": 1,
         "properties": {
           "tokenStore": "<key type='CircuitContainer'><id field='name' value='XXXXXXX'/><key type='CircuitContainer'><id field='name' value='XXXXXXXXX'/><key type='FilterCircuit'><id field='name' value='Token Validation Policy'/></key></key></key>",
           "accessTokenLocation": "HEADER",
           "authorizationHeaderPrefix": "Bearer",
           "accessTokenLocationQueryString": "",
           "scopesMustMatch": "Any",
           "scopes": "empty-allow",
           "removeCredentialsOnSuccess": true,
           "implicitGrantEnabled": true,
           "useClientRegistry": true,
           "implicitGrantLoginEndpointUrl": "https://localhost:8089/api/oauth/authorize",
           "implicitGrantLoginTokenName": "access_token",
           "authCodeGrantTypeEnabled": true,
           "authCodeGrantTypeRequestEndpointUrl": "https://localhost:8089/api/oauth/authorize",
           "authCodeGrantTypeRequestClientIdName": "client_id",
           "authCodeGrantTypeRequestSecretName": "client_secret",
           "authCodeGrantTypeTokenEndpointUrl": "https://localhost:8089/api/oauth/token",
           "authCodeGrantTypeTokenEndpointTokenName": "access_code",
           "subjectSelector": "${oauth.token.client_id}",
           "oauth.token.client_id": "${oauth.token.client_id}",
           "oauth.token.scopes": "${oauth.token.scopes}",
           "oauth.token.valid": "${oauth.token.valid}",
           "oauth.token.uid": "${oauth.token.uid}"
         }
       }
     ]
   }
 ]

Relevant log output

we got this error :


2024-04-05 12:07:57,638 [RestAPICall] DEBUG: Http verb:GET and URI: https://ourserver:443/api/portal/v1.4/policies?type=oauthtokeninfo
2024-04-05 12:07:57,672 [APIImportApp] ERROR: Invalid Oauth token info policy : <key type='CircuitContainer'><id field='name' value='XXXXXXX'/><key type='CircuitContainer'><id field='name' value='XXXXXXXXX'/><key type='FilterCircuit'><id field='name' value='Token Validation Policy'/></key></key></key>
com.axway.apim.lib.error.AppException: Invalid Oauth token info policy : <key type='CircuitContainer'><id field='name' value='XXXXXXX'/><key type='CircuitContainer'><id field='name' value='XXXXXXXXX'/><key type='FilterCircuit'><id field='name' value='Token Validation Policy'/></key></key></key>
	at com.axway.apim.adapter.apis.APIManagerPoliciesAdapter.handleExternalOauth(APIManagerPoliciesAdapter.java:210)
	at com.axway.apim.adapter.apis.APIManagerPoliciesAdapter.updateSecurityProfiles(APIManagerPoliciesAdapter.java:182)
	at com.axway.apim.apiimport.APIChangeState.getChanges(APIChangeState.java:66)
	at com.axway.apim.apiimport.APIChangeState.<init>(APIChangeState.java:54)
	at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:93)
	at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:52)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:129)
	at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:72)
2024-04-05 12:07:57,675 [APIManagerAdapter] DEBUG: Closing cache ...
@gfonteneau gfonteneau added the bug Something isn't working label Apr 5, 2024
@rathnapandi
Copy link
Member

Hi @gfonteneau,

Can you change the element tokenStore from

           "tokenStore": "<key type='CircuitContainer'><id field='name' value='XXXXXXX'/><key type='CircuitContainer'><id field='name' value='XXXXXXXXX'/><key type='FilterCircuit'><id field='name' value='Token Validation Policy'/></key></key></key>",

to

 "tokenStore": "Token Validation Policy"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants