[keycloak-user] Create user + keycloak-admin-client

Stian Thorgersen sthorger at redhat.com
Thu Feb 11 03:18:22 EST 2016


The realm you pass into Keycloak.getInstance is the realm you are
authenticating the user with. Is your admin user in the master realm? If so
use "master" there instead of "forum".

The other issue you are seeing is related to the version of Jackson you are
using. In 1.9.0.CR1 we upgraded to Jackson2 (fasterxml), in 1.8.0 we
required Jackson1. Take a look at the admin-client example it shows how to
exclude Jackson2 and include Jackson1 instead. Or you can upgrade to
1.9.0.CR1.


On 11 February 2016 at 00:49, Charles Queiroz <charles at dazen.com.br> wrote:

> Hi folks,
>
> I’m trying programmatically add user in keycloak server using the admin
> client (version 1.8.0.RC3) like this post show (link:
> http://www.first8.nl/blog/programmatically-adding-users-in-keycloak/ ),
> but no success yet! ;(
>
>
>
> The Steps:
>
> 1 - Add dependence on pom.xml like:
>
> <dependency>
>     <groupId>org.keycloak</groupId>
>     <artifactId>keycloak-admin-client</artifactId>
>     <version>1.8.0.CR3</version>
> </dependency>
>
>
> 2 - Implement the method body like:
>
>
> public User save(User user) {
>     Keycloak kc = Keycloak.getInstance("http://localhost:8080/auth", "forum", “admin", “admin", "security-admin-console");
>
>     CredentialRepresentation credential = new CredentialRepresentation();
>     credential.setType(CredentialRepresentation.PASSWORD);
>     credential.setValue(user.getPassword());
>     UserRepresentation newUser = new UserRepresentation();
>     newUser.setUsername(user.getLogin());
>     newUser.setFirstName(user.getName());
>     newUser.setCredentials(Arrays.asList(credential));
>
>     kc.realm("forum").users().create(newUser);
>
>     User saved = repository.save(user);
>     savedUser.fire(saved);
>     return saved;
> }
>
>
> When I run the app, the exception thrown is:
>
> 20:46:03,583 DEBUG [org.apache.http.impl.conn.DefaultClientConnection]
> (default task-14) Sending request: POST
> /auth/realms/forum/protocol/openid-connect/token HTTP/1.1
> 20:46:03,584 DEBUG [org.apache.http.wire] (default task-14)  >> "POST
> /auth/realms/forum/protocol/openid-connect/token HTTP/1.1[\r][\n]"
> 20:46:03,585 DEBUG [org.apache.http.wire] (default task-14)  >> "Accept:
> application/json[\r][\n]"
> 20:46:03,587 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Accept-Encoding: gzip, deflate[\r][\n]"
> 20:46:03,589 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Content-Type: application/x-www-form-urlencoded[\r][\n]"
> 20:46:03,591 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Content-Length: 82[\r][\n]"
> 20:46:03,592 DEBUG [org.apache.http.wire] (default task-14)  >> "Host:
> localhost:8080[\r][\n]"
> 20:46:03,594 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Connection: Keep-Alive[\r][\n]"
> 20:46:03,596 DEBUG [org.apache.http.wire] (default task-14)  >> "[\r][\n]"
> 20:46:03,598 DEBUG [org.apache.http.headers] (default task-14) >> POST
> /auth/realms/forum/protocol/openid-connect/token HTTP/1.1
> 20:46:03,599 DEBUG [org.apache.http.headers] (default task-14) >> Accept:
> application/json
> 20:46:03,601 DEBUG [org.apache.http.headers] (default task-14) >>
> Accept-Encoding: gzip, deflate
> 20:46:03,602 DEBUG [org.apache.http.headers] (default task-14) >>
> Content-Type: application/x-www-form-urlencoded
> 20:46:03,604 DEBUG [org.apache.http.headers] (default task-14) >>
> Content-Length: 82
> 20:46:03,605 DEBUG [org.apache.http.headers] (default task-14) >> Host:
> localhost:8080
> 20:46:03,606 DEBUG [org.apache.http.headers] (default task-14) >>
> Connection: Keep-Alive
> 20:46:03,610 DEBUG [org.apache.http.wire] (default task-14)  >>
> "grant_type=password&username=admin&password=admin&client_id=security-admin-console"
> 20:46:03,612 DEBUG [org.jboss.resteasy.resteasy_jaxrs.i18n] (default
> task-15) RESTEASY002315: PathInfo:
> /realms/forum/protocol/openid-connect/token
> 20:46:03,614 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) AUTHENTICATE CLIENT
> 20:46:03,614 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) client authenticator: client-secret
> 20:46:03,614 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) client authenticator SUCCESS: client-secret
> 20:46:03,614 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) Client security-admin-console authenticated by
> client-secret
> 20:46:03,615 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) AUTHENTICATE ONLY
> 20:46:03,615 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) processFlow
> 20:46:03,615 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) check execution: direct-grant-validate-username
> requirement: REQUIRED
> 20:46:03,616 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator: direct-grant-validate-username
> 20:46:03,616 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) invoke authenticator.authenticate
> 20:46:03,617 FINE  [org.mongodb.driver.protocol.query] (default task-15)
> Sending query of namespace forum.users on connection
> [connectionId{localValue:2, serverValue:184}] to server 127.0.0.1:27017
> 20:46:03,617 FINE  [org.mongodb.driver.protocol.query] (default task-15)
> Query completed
> 20:46:03,618 WARN  [org.keycloak.events] (default task-15)
> type=LOGIN_ERROR, realmId=forum, clientId=security-admin-console,
> userId=null, ipAddress=127.0.0.1, error=invalid_user_credentials,
> auth_method=openid-connect, grant_type=password,
> client_auth_method=client-secret, username=admin
> 20:46:03,619 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator FAILED: direct-grant-validate-username
> 20:46:03,624 DEBUG [org.apache.http.wire] (default task-14)  << "HTTP/1.1
> 401 Unauthorized[\r][\n]"
> 20:46:03,627 DEBUG [org.apache.http.wire] (default task-14)  <<
> "Connection: keep-alive[\r][\n]"
> 20:46:03,629 DEBUG [org.apache.http.wire] (default task-14)  <<
> "X-Powered-By: Undertow/1[\r][\n]"
> 20:46:03,631 DEBUG [org.apache.http.wire] (default task-14)  << "Server:
> WildFly/10[\r][\n]"
> 20:46:03,632 DEBUG [org.apache.http.wire] (default task-14)  <<
> "Transfer-Encoding: chunked[\r][\n]"
> 20:46:03,634 DEBUG [org.apache.http.wire] (default task-14)  <<
> "Content-Type: application/json[\r][\n]"
> 20:46:03,636 DEBUG [org.apache.http.wire] (default task-14)  << "Date:
> Wed, 10 Feb 2016 23:46:03 GMT[\r][\n]"
> 20:46:03,637 DEBUG [org.apache.http.wire] (default task-14)  << "[\r][\n]"
> 20:46:03,639 DEBUG [org.apache.http.impl.conn.DefaultClientConnection]
> (default task-14) Receiving response: HTTP/1.1 401 Unauthorized
> 20:46:03,640 DEBUG [org.apache.http.headers] (default task-14) << HTTP/1.1
> 401 Unauthorized
> 20:46:03,642 DEBUG [org.apache.http.headers] (default task-14) <<
> Connection: keep-alive
> 20:46:03,643 DEBUG [org.apache.http.headers] (default task-14) <<
> X-Powered-By: Undertow/1
> 20:46:03,645 DEBUG [org.apache.http.headers] (default task-14) << Server:
> WildFly/10
> 20:46:03,646 DEBUG [org.apache.http.headers] (default task-14) <<
> Transfer-Encoding: chunked
> 20:46:03,647 DEBUG [org.apache.http.headers] (default task-14) <<
> Content-Type: application/json
> 20:46:03,649 DEBUG [org.apache.http.headers] (default task-14) << Date:
> Wed, 10 Feb 2016 23:46:03 GMT
> 20:46:03,651 DEBUG [org.apache.http.impl.client.DefaultHttpClient]
> (default task-14) Connection can be kept alive indefinitely
> 20:46:03,653 DEBUG [org.apache.http.impl.client.DefaultHttpClient]
> (default task-14) Authentication required
> 20:46:03,654 DEBUG [org.apache.http.impl.client.DefaultHttpClient]
> (default task-14) localhost:8080 requested authentication
> 20:46:03,656 DEBUG [org.apache.http.impl.client.DefaultHttpClient]
> (default task-14) Response contains no authentication challenges
> 20:46:03,665 DEBUG [org.apache.http.wire] (default task-14)  <<
> "48[\r][\n]"
> 20:46:03,667 DEBUG [org.apache.http.wire] (default task-14)  <<
> "{"error_description":"Invalid user credentials","error":"invalid_grant"}"
> 20:46:03,668 DEBUG [org.apache.http.wire] (default task-14)  << "[\r][\n]"
> 20:46:03,670 DEBUG [org.apache.http.wire] (default task-14)  << "0[\r][\n]"
> 20:46:03,671 DEBUG [org.apache.http.wire] (default task-14)  << "[\r][\n]"
> 20:46:03,673 DEBUG
> [org.apache.http.impl.conn.BasicClientConnectionManager] (default task-14)
> Releasing connection
> org.apache.http.impl.conn.ManagedClientConnectionImpl at 1d6c4f71
> 20:46:03,675 DEBUG
> [org.apache.http.impl.conn.BasicClientConnectionManager] (default task-14)
> Connection can be kept alive indefinitely
> 20:46:11,315 DEBUG [org.jboss.as.jpa] (default task-14) default
> task-14:transaction scoped EntityManager [forum.war#ForumPU]: closing
> entity managersession
> 20:46:11,315 DEBUG
> [org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl]
> (default task-14) Initiating JDBC connection release from afterTransaction
> 20:46:11,316 ERROR [org.jboss.as.ejb3.invocation] (default task-14)
> WFLYEJB0034: EJB Invocation failed on component UserRestEndpoint for method
> public javax.ws.rs.core.Response
> br.com.projetolead.forum.integration.rest.UserRestEndpoint.save(br.com.projetolead.forum.model.User,javax.servlet.http.HttpServletRequest)
> throws java.io.IOException: javax.ejb.EJBException:
> javax.ws.rs.NotAuthorizedException: HTTP 401 Unauthorized
> at
> org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
>
>
> ------
>
> but, when I change the user to charles (no admin user. login: charles,
> password: java) the error is:
>
> ------
>
> 20:41:18,314 DEBUG [org.apache.http.impl.conn.DefaultClientConnection]
> (default task-14) Sending request: POST
> /auth/realms/forum/protocol/openid-connect/token HTTP/1.1
> 20:41:18,315 DEBUG [org.apache.http.wire] (default task-14)  >> "POST
> /auth/realms/forum/protocol/openid-connect/token HTTP/1.1[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >> "Accept:
> application/json[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Accept-Encoding: gzip, deflate[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Content-Type: application/x-www-form-urlencoded[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Content-Length: 83[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >> "Host:
> localhost:8080[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >>
> "Connection: Keep-Alive[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >> "[\r][\n]"
> 20:41:18,316 DEBUG [org.apache.http.headers] (default task-14) >> POST
> /auth/realms/forum/protocol/openid-connect/token HTTP/1.1
> 20:41:18,316 DEBUG [org.apache.http.headers] (default task-14) >> Accept:
> application/json
> 20:41:18,316 DEBUG [org.apache.http.headers] (default task-14) >>
> Accept-Encoding: gzip, deflate
> 20:41:18,316 DEBUG [org.apache.http.headers] (default task-14) >>
> Content-Type: application/x-www-form-urlencoded
> 20:41:18,316 DEBUG [org.apache.http.headers] (default task-14) >>
> Content-Length: 83
> 20:41:18,316 DEBUG [org.apache.http.headers] (default task-14) >> Host:
> localhost:8080
> 20:41:18,316 DEBUG [org.apache.http.headers] (default task-14) >>
> Connection: Keep-Alive
> 20:41:18,316 DEBUG [org.apache.http.wire] (default task-14)  >>
> "grant_type=password&username=charles&password=java&client_id=security-admin-console"
> 20:41:18,318 DEBUG [org.jboss.resteasy.resteasy_jaxrs.i18n] (default
> task-15) RESTEASY002315: PathInfo:
> /realms/forum/protocol/openid-connect/token
> 20:41:18,320 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) AUTHENTICATE CLIENT
> 20:41:18,320 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) client authenticator: client-secret
> 20:41:18,320 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) client authenticator SUCCESS: client-secret
> 20:41:18,320 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) Client security-admin-console authenticated by
> client-secret
> 20:41:18,321 DEBUG [org.keycloak.authentication.AuthenticationProcessor]
> (default task-15) AUTHENTICATE ONLY
> 20:41:18,321 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) processFlow
> 20:41:18,321 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) check execution: direct-grant-validate-username
> requirement: REQUIRED
> 20:41:18,322 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator: direct-grant-validate-username
> 20:41:18,322 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) invoke authenticator.authenticate
> 20:41:18,322 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator SUCCESS: direct-grant-validate-username
> 20:41:18,322 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) check execution: direct-grant-validate-password
> requirement: REQUIRED
> 20:41:18,322 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator: direct-grant-validate-password
> 20:41:18,322 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) invoke authenticator.authenticate
> 20:41:18,323 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator SUCCESS: direct-grant-validate-password
> 20:41:18,323 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) check execution: direct-grant-validate-otp requirement:
> OPTIONAL
> 20:41:18,323 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator: direct-grant-validate-otp
> 20:41:18,323 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) invoke authenticator.authenticate
> 20:41:18,323 DEBUG [org.keycloak.authentication.DefaultAuthenticationFlow]
> (default task-15) authenticator ATTEMPTED: direct-grant-validate-otp
> 20:41:18,360 DEBUG [org.keycloak.events] (default task-15) type=LOGIN,
> realmId=forum, clientId=security-admin-console,
> userId=f785e600-124c-4e26-914e-2c4f6ec9c95b, ipAddress=127.0.0.1,
> auth_method=openid-connect, token_id=4dd8bbcb-e771-4652-8711-b2c0937bb8fe,
> grant_type=password, refresh_token_type=Refresh,
> refresh_token_id=c0e58e55-9edc-4940-9ff4-52a5a5a9f577,
> client_auth_method=client-secret, username=charles
> 20:41:18,363 DEBUG [org.apache.http.wire] (default task-14)  << "HTTP/1.1
> 200 OK[\r][\n]"
> 20:41:18,363 DEBUG [org.apache.http.wire] (default task-14)  <<
> "Connection: keep-alive[\r][\n]"
> 20:41:18,364 DEBUG [org.apache.http.wire] (default task-14)  <<
> "X-Powered-By: Undertow/1[\r][\n]"
> 20:41:18,364 DEBUG [org.apache.http.wire] (default task-14)  << "Server:
> WildFly/10[\r][\n]"
> 20:41:18,364 DEBUG [org.apache.http.wire] (default task-14)  <<
> "Transfer-Encoding: chunked[\r][\n]"
> 20:41:18,364 DEBUG [org.apache.http.wire] (default task-14)  <<
> "Content-Type: application/json[\r][\n]"
> 20:41:18,364 DEBUG [org.apache.http.wire] (default task-14)  << "Date:
> Wed, 10 Feb 2016 23:41:18 GMT[\r][\n]"
> 20:41:18,364 DEBUG [org.apache.http.wire] (default task-14)  << "[\r][\n]"
> 20:41:18,364 DEBUG [org.apache.http.impl.conn.DefaultClientConnection]
> (default task-14) Receiving response: HTTP/1.1 200 OK
> 20:41:18,364 DEBUG [org.apache.http.headers] (default task-14) << HTTP/1.1
> 200 OK
> 20:41:18,364 DEBUG [org.apache.http.headers] (default task-14) <<
> Connection: keep-alive
> 20:41:18,364 DEBUG [org.apache.http.headers] (default task-14) <<
> X-Powered-By: Undertow/1
> 20:41:18,364 DEBUG [org.apache.http.headers] (default task-14) << Server:
> WildFly/10
> 20:41:18,364 DEBUG [org.apache.http.headers] (default task-14) <<
> Transfer-Encoding: chunked
> 20:41:18,364 DEBUG [org.apache.http.headers] (default task-14) <<
> Content-Type: application/json
> 20:41:18,364 DEBUG [org.apache.http.headers] (default task-14) << Date:
> Wed, 10 Feb 2016 23:41:18 GMT
> 20:41:18,364 DEBUG [org.apache.http.impl.client.DefaultHttpClient]
> (default task-14) Connection can be kept alive indefinitely
> 20:41:18,386 DEBUG [org.apache.http.wire] (default task-14)  <<
> "0ed6[\r][\n]"
> 20:41:18,386 DEBUG [org.apache.http.wire] (default task-14)  <<
> "{"access_token":"eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI0ZGQ4YmJjYi1lNzcxLTQ2NTItODcxMS1iMmMwOTM3YmI4ZmUiLCJleHAiOjE0NTUxNDc5NzgsIm5iZiI6MCwiaWF0IjoxNDU1MTQ3Njc4LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvZm9ydW0iLCJhdWQiOiJzZWN1cml0eS1hZG1pbi1jb25zb2xlIiwic3ViIjoiZjc4NWU2MDAtMTI0Yy00ZTI2LTkxNGUtMmM0ZjZlYzljOTViIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoic2VjdXJpdHktYWRtaW4tY29uc29sZSIsInNlc3Npb25fc3RhdGUiOiIyYzkwMDMzOS1mNjNhLTQ4MGItYjJiZS0wZjZmNDlkNDc3MmYiLCJjbGllbnRfc2Vzc2lvbiI6IjE4YTlhNDQ1LTVkMWMtNGYyZi1iNmYxLTI0NDdkZGQzYzAxNSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlc291cmNlX2FjY2VzcyI6eyJyZWFsbS1tYW5hZ2VtZW50Ijp7InJvbGVzIjpbInZpZXctaWRlbnRpdHktcHJvdmlkZXJzIiwidmlldy1yZWFsbSIsIm1hbmFnZS1pZGVudGl0eS1wcm92aWRlcnMiLCJpbXBlcnNvbmF0aW9uIiwicmVhbG0tYWRtaW4iLCJjcmVhdGUtY2xpZW50IiwibWFuYWdlLXVzZXJzIiwibWFuYWdlLWV2ZW50cyIsIm1hbmFnZS1yZWFsbSIsInZpZXctZXZlbnRzIiwidmlldy11c2VycyIsInZpZXctY2xpZW50cyIsIm1hbmFnZS1jbGllbnRzIl19fSwibmFtZSI6IkN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l9zdGF0ZSI6IjJjOTAwMzM5LWY2M2EtNDgwYi1iMmJlLTBmNmY0OWQ0NzcyZiIsIm5hbWUiOiJDaGFybGVzIFF1ZWlyb3oiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJjaGFybGVzIiwiZ2l2ZW5fbmFtZSI6IkNoYXJsZXMiLCJsb2NhbGUiOiJwdC1CUiIsImZhbWlseV9uYW1lIjoiUXVlaXJveiIsImVtYWlsIjoiY2hhcmxlc0BkYXplbi5jb20ifQ.YxeYJ9cKFyDRQ1YyJbwflQSr-n8l9nW1ORsvQbWo1XYfd6UqiUJlSsygIg4JqFIJGfCU_X8DJcV5HmdOtt90IHqW0_Oc6P8ZvVA1UdGEcoWlVBi88Hd_dIGC3WgyaE4WdOW1KC6nh3Eba2KmdUPQQ3xRKYXd9-pxmE2DwDrHZtONd8EaqTeK4J8vE34Jr_BQyNdv9yGztUh73AGVXAeVk4MqKBRAVmcod_eYOpaaf2OfQwaHQZpskwVqrEIIffyXmIMwD1MbmIP4tMPdMnNBK7bzNO-Qx7VTgWOuTu-VRQQoH0-fXetJdxKb5O1_2G7qCi_CYLeolh2DbIWswM6bag","not-before-policy":0,"session-state":"2c900339-f63a-480b-b2be-0f6f49d4772f"}"
> 20:41:18,409 DEBUG [org.apache.http.wire] (default task-14)  << "[\r][\n]"
> 20:41:18,409 DEBUG [org.apache.http.wire] (default task-14)  << "0[\r][\n]"
> 20:41:18,409 DEBUG [org.apache.http.wire] (default task-14)  << "[\r][\n]"
> 20:41:18,409 DEBUG
> [org.apache.http.impl.conn.BasicClientConnectionManager] (default task-14)
> Releasing connection
> org.apache.http.impl.conn.ManagedClientConnectionImpl at 24993c5f
> 20:41:18,409 DEBUG
> [org.apache.http.impl.conn.BasicClientConnectionManager] (default task-14)
> Connection can be kept alive indefinitely
> 20:41:18,413 DEBUG [org.jboss.as.jpa] (default task-14) default
> task-14:transaction scoped EntityManager [forum.war#ForumPU]: closing
> entity managersession
> 20:41:18,414 DEBUG
> [org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl]
> (default task-14) Initiating JDBC connection release from afterTransaction
> 20:41:18,414 ERROR [org.jboss.as.ejb3.invocation] (default task-14)
> WFLYEJB0034: EJB Invocation failed on component UserRestEndpoint for method
> public javax.ws.rs.core.Response
> br.com.projetolead.forum.integration.rest.UserRestEndpoint.save(br.com.projetolead.forum.model.User,javax.servlet.http.HttpServletRequest)
> throws java.io.IOException: javax.ejb.EJBException:
> javax.ws.rs.client.ResponseProcessingException:
> javax.ws.rs.ProcessingException:
> com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:
> Unrecognized field "access_token" (class
> org.keycloak.representations.AccessTokenResponse), not marked as ignorable
> (9 known properties: "notBeforePolicy", "otherClaims", "tokenType",
> "token", "expiresIn", "sessionState", "refreshExpiresIn", "idToken",
> "refreshToken"])
>  at [Source: org.apache.http.conn.EofSensorInputStream at 5af6ffba; line: 1,
> column: 18] (through reference chain:
> org.keycloak.representations.AccessTokenResponse["access_token”])
>
> ------
>
>
> Where is the problem?
>
> Atenciosamente,
>
> *Charles Queiroz *
> ------------------------------
>
> *Dazen™* *IT Services*
> *Technology - Software Development *
> charles at dazen.com.br
> Fortaleza - CE
> Phone: +55 85 9933 1585
>
> Twitter: @CharlesQueiiroz
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160211/af76a807/attachment-0001.html 


More information about the keycloak-user mailing list