[keycloak-user] Updating resources via adapter client

Richard van Duijn rjvduijn at gmail.com
Wed Dec 28 08:29:20 EST 2016


Hi,
Referring to ticket: https://issues.jboss.org/browse/KEYCLOAK-4136

I'm puzzled. I was investigating the possibility to update a given resource
(for instance updating the name of the resource). I read the documentation (
here
<https://keycloak.gitbooks.io/authorization-services-guide/content/v/2.4/topics/service/protection/resources-api-papi.html>)
stating that there is a PUT endpoint with the path set to:* Update resource
set description: PUT /resource_set/{_id}*

I use the AuthzClient to manage resources from my client using the line:
*ProtectedResource resourceClient =
this.authzClient.protection().resource()*;
The ProtectedResource class does not implement the updateResource method.
(I hope this will be fixed soon.)
BUT, I attempted to implement the logic myself but kept receiving a *405*
response from keycloak stating. Details on the call can be found here
<https://issues.jboss.org/browse/KEYCLOAK-4136?focusedCommentId=13341799&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13341799>
In the debug mode I get the following data:

 "PUT
/auth/realms/photoz/authz/protection/resource_set/98800456-37d5-4ebe-9a63-c007e7bdd70b
HTTP/1.1[\r][\n]"
14:17:52.610 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"Authorization: Bearer [BEARER-TOKEN-HERE][\r][\n]"
14:17:52.610 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"Content-Type: application/json[\r][\n]"
14:17:52.610 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"Content-Length: 206[\r][\n]"
14:17:52.610 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host:
127.0.0.1:8080[\r][\n]"
14:17:52.610 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"Connection: Keep-Alive[\r][\n]"
14:17:52.610 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_112)[\r][\n]"
14:17:52.610 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"Accept-Encoding: gzip,deflate[\r][\n]"
14:17:52.612 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"[\r][\n]"
14:17:52.612 [main] DEBUG org.apache.http.wire - http-outgoing-0 >>
"{"name":"my-resource-2","uri":"/test/1","type":"urn:nl.company:type:testresource","scopes":[{"name":"urn:
nl.company
:scope:testscope"}],"owner":"admin","_id":"98800456-37d5-4ebe-9a63-c007e7bdd70b"}"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 <<
"HTTP/1.1 405 Method Not Allowed[\r][\n]"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Allow:
HEAD, DELETE, GET, OPTIONS[\r][\n]"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 <<
"Connection: keep-alive[\r][\n]"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 <<
"X-Powered-By: Undertow/1[\r][\n]"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 <<
"Server: WildFly/10[\r][\n]"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 <<
"Content-Length: 0[\r][\n]"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Date:
Wed, 28 Dec 2016 13:17:52 GMT[\r][\n]"
14:17:52.620 [main] DEBUG org.apache.http.wire - http-outgoing-0 <<
"[\r][\n]"


Is the endpoint correctly configured or is there something else I'm doing
incorrectly.


More information about the keycloak-user mailing list