apiman: Problems with keycloak oauth plugin and postgres database

Hi,

we observed and reproduced a really strange behavior using PostgreSQL in combination with the keycloak oauth authentication plugin. As soon as we configure postgres as apiman-manager database and install the “keycloak-oauth-policy” policy any time we open the plugin editor we double the entries of this plugin in the table “pd_templates”. After reaching a really high number of duplicated entries the application is not able to handle it anymore and from that point in time we are not able to open the policies in the UI or publish them.

I followed more or less the chapter 7.2.2 from http://www.apiman.io/latest/production-guide.html except the datasource configuration has been moved inside standalone-apiman.conf (needed that to evaluate environment properties). I also tried a newer postgres driver without any change.

I created a small docker-compose demo which can be downloaded here

After starting the demo with:

docker-compose up --build

  • Login into apiman and install the “Keycloak OAuth Policy Plugin” plugin.
  • Connect to the local exposed postgres database “apiman_manager” on localhost:5432 with user “apiman” and password “apiman” and execute following select query: SELECT * FROM pd_templates WHERE policydef_id = 'keycloak-oauth-policy'; The result should be a single entry.
  • Create a new organization and API.
  • Go to “Add Policy” and choose “Keycloak OAuth Policy” so that the plugin configuration page opens.
  • Again fetch the entries of the database with: SELECT * FROM pd_templates WHERE policydef_id = 'keycloak-oauth-policy';
  • Any time this editor is opened the entries are doubled in the database.

Any idea about the cause of such a behaviour?

Thx for any help

best

/david

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (14 by maintainers)

Most upvoted comments

No concerns from our side 😃

Yes for sure we can do that. @volkflo @msavy any issues with that?

Hi Eric, sorry for my late reply, have been in vacation 😉 So finally I verified your changes in 1.5.3-SNAHOST, git-hash: 13ffd8e4f4dd98a23ed12f3c862e9ae40f660910

Replaced apiman.war and apimanui.war in docker image “apiman/on-wildfly11:1.5.1.Final” and the entries are not reduplicated anymore. Problem is fixed!

Thx a lot.