OAuth-Apis / apis

OAuth Authorization as a Service
Apache License 2.0
594 stars 301 forks source link

AS /admin/resourceServer mixes ResourceServer and Client IDs #54

Open martinhaase opened 10 years ago

martinhaase commented 10 years ago

I have an RS and a Client, both have an ID of 22222 in the DB (set up in analogy to V1__auth-server-admin.sql). Now when I want e.g. add an additional scope to that RS via the admin client interface (a modification which ends up in a POST to /oauth2/admin/resourceServer/22222), the user agent sees an Internal Server Error, with the Cause in apis.log:

org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Attempted to attach instance "22222" of type "class org.surfnet.oaaas.model.ResourceServer", but this instance is already in the datastore as type "class org.surfnet.oaaas.model.Client".

I believe this is a bug, or otherwise one needs a specification that ID ranges of different classes must be kept apart (a workaround I chose short-term).

gvanderploeg commented 10 years ago

Perhaps a bug in OpenJPA, like https://issues.apache.org/jira/browse/OPENJPA-1061 ?

martinhaase commented 10 years ago

The linked JPA issue claims to be fixed in OpenJPA v2.0.0x. I see the bug in AS 1.3.6-SNAPSHOT, with an openjpa-2.2.0.jar.