Hi Alexander,
  On a second look, my problem was with my tomcat application that integrates with Keycloak. This tomcat application was using fasterxml jackson parser whereas keycloak implementation uses codehaus jackson which gets overridden during runtime. I was able to overcome this problem by creating PropertyNamingStrategy and set it to ObjectMapper before deserializing the JSON.

Alternatively Keycloak implementation can be modified to use fasterxml jackson databinding.

-Kamal


From: Alexander Chriztopher <alexander.chriztopher@gmail.com>
To: Kamal Jagadevan <j.kamal@ymail.com>
Cc: "keycloak-user@lists.jboss.org" <keycloak-user@lists.jboss.org>
Sent: Monday, October 27, 2014 12:54 PM
Subject: Re: [keycloak-user] Java API documentation

Hi Kamal and thanks.

Am using the keycloak admin client which brings the following Jackson dependency : jackson-core-asl:1.9.9 and can not override this. I also don't have the option to change the property mapping as it comes with the Keycloak distribution am using :-(



On Mon, Oct 27, 2014 at 4:54 PM, Kamal Jagadevan <j.kamal@ymail.com> wrote:
Hi Alexander,
   I had faced the same problem few days back it is because of the mismatch between JSONProperty and POJO variable name(getter method) that too with fasterxml jackson parser.
If you use codehaus jackson parser you wouldnt get any problem. One work around to this problem is to update the POJO variable name to reflect the JSONProperty name.
Similar problem is observed in multiple places where deserialization kicks in..

Specifically it is because of this

    @JsonProperty("access_token")
    protected String token;

Hi Bill,
    Do you have any other ideas besides updating POJOs member variable name matching the JSON property? Please advise.

Thanks
Kamal
 


From: Alexander Chriztopher <alexander.chriztopher@gmail.com>
To: "keycloak-user@lists.jboss.org" <keycloak-user@lists.jboss.org>
Sent: Monday, October 27, 2014 11:45 AM
Subject: [keycloak-user] Java API documentation

Hi All,
 
Am using Keycloak 1.0.2.Final and am getting this error when using the rest API :
 
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "access_token" (class org.keycloak.representations.AccessTokenResponse), not marked as ignorable (7 known properties: "tokenType", "notBeforePolicy", "token", "expiresIn", "sessionState", "refreshToken", "idToken"])
at [Source: org.apache.http.conn.EofSensorInputStream@11b8a95d; line: 1, column: 18] (through reference chain: org.keycloak.representations.AccessTokenResponse["access_token"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:671) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:771) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1297) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1275) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:247) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1233) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:677) [jackson-databind-2.3.2.jar:2.3.2]
at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.readFrom(ResteasyJackson2Provider.java:120) [resteasy-jackson2-provider-3.0.8.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:59) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:51) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor.aroundReadFrom(DigitalVerificationInterceptor.java:32) [resteasy-crypto-3.0.8.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:248) [resteasy-client-3.0.8.Final.jar:]
... 164 more

Was wondering where this comes from as am using the 1.0.2.Final admin api and have updated my Wildfly Server accordingly.

_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user