[keycloak-user] Exception with User Storage SPI priority configuration

Thomas Darimont thomas.darimont at googlemail.com
Thu Nov 3 14:18:36 EDT 2016


Hello,

I could reproduce this with the "user-storage-jpa-example" from
examples/provider in the keycloak repository.

I installed the provider via: mvn clean install wildfly:deploy
Then I created a new provider instance for "example-user-storage-jpa" in
the admin-console / User Federation

In the create screen the "priority" field is populated with "0". After
saving the priority field is empty.
If one now tries to set a priority one sees an error message: *Error!* An
unexpected server error has occurred

The server console now shows the stacktrace mentioned by Niko.

Cheers,
Thomas

2016-11-03 18:21 GMT+01:00 Bill Burke <bburke at redhat.com>:

> Ok, can you clarify how to reproduce this problem?  Are you creating
> storage providers through the rest interface?  Or does this problem surface
> through the admin console?
>
> On 11/3/16 11:49 AM, Thomas Darimont wrote:
>
> Hello,
>
> I'm facing the same problem - could you point me to the commit that fixed
> this in master?
>
> Cheers,
> Thomas
>
> 2016-11-01 15:17 GMT+01:00 Bill Burke <bburke at redhat.com>:
>
>> Its an admin console issue.  I think I fixed it in master, but I 'll
>> double check.
>>
>>
>> On 11/1/16 3:35 AM, Niko Köbler wrote:
>> > Hi,
>> >
>> > I just tested and investigated a bit more…
>> >
>> > When saving a UserStorageProvider, the „priority“ value is sent within
>> the config object:
>> > {
>> >    "id": "320db9e2-6c40-4eb5-868e-95717be36fce",
>> >    "name": "my-user-storage",
>> >    "providerId": "my-user-storage",
>> >    "providerType": "org.keycloak.storage.UserStorageProvider",
>> >    "parentId": "demo",
>> >    "config": {
>> >      "baseUrl": [
>> >        "http://localhost:9000"
>> >      ],
>> >      "basicAuthUsername": [
>> >        "admin"
>> >      ],
>> >      "basicAuthPassword": [
>> >        "secret"
>> >      ],
>> >      "priority": {
>> >        "0": "1"
>> >      }
>> >    }
>> > }
>> >
>> > In contrast to a UserFederationProvider, where the „priority“ value is
>> sent as part of the root object, not in the nested config object.
>> >
>> > When adding a „priority“ config property in my UserStorageProvider, it
>> works, but it looks strange in the Admin console, as there are now 2
>> priority fields… but it works.
>> >
>> > Additionally, this error with the priority value leads to some JS error
>> messages in the browser console when working with the Admin console. These
>> are also gone when using an own „priority“ config property.
>> >
>> > I’d appreciate any feedback on this, if this is an error or whatever…
>> > Thanks!
>> >
>> > Regards,
>> > - Niko
>> >
>> >
>> >
>> >> Am 31.10.2016 um 16:15 schrieb Niko Köbler <niko at n-k.de>:
>> >>
>> >> Hi,
>> >>
>> >> I just implemented the User Storage SPI as replacement for our User
>> Federation SPI.
>> >>
>> >> Creating the User-Storage Provider works w/o errors, but not Priority
>> value will be saved.
>> >> When updating the Provider with a value for Priority, it will fail
>> with an exception (see below), updating the Provider without setting a
>> value for Priority works.
>> >>
>> >> Do I have to implement/configure something special to get it work?
>> >> I based my implementation on the user-storage-jpa-example, provided
>> with Keycloak.
>> >> Or is it a general error? Should a create a Jira issue for it?
>> >>
>> >>
>> >> The exception/stack trace:
>> >> 16:03:14,392 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default
>> task-31) RESTEASY002005: Failed executing PUT /admin/realms/connect/componen
>> ts/320db9e2-6c40-4eb5-868e-95717be36fce: org.jboss.resteasy.spi.ReaderException:
>> com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize
>> instance of java.util.ArrayList out of START_OBJECT token
>> >> at [Source: io.undertow.servlet.spec.ServletInputStreamImpl at 1a486a1f;
>> line: 1, column: 387] (through reference chain:
>> org.keycloak.representations.idm.ComponentRepresentation["co
>> nfig"]->org.keycloak.common.util.MultivaluedHashMap["priority"])
>> >>              at org.jboss.resteasy.core.Messag
>> eBodyParameterInjector.inject(MessageBodyParameterInjector.java:184)
>> >>              at org.jboss.resteasy.core.Method
>> InjectorImpl.injectArguments(MethodInjectorImpl.java:91)
>> >>              at org.jboss.resteasy.core.Method
>> InjectorImpl.invoke(MethodInjectorImpl.java:114)
>> >>              at org.jboss.resteasy.core.Resour
>> ceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
>> >>              at org.jboss.resteasy.core.Resour
>> ceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
>> >>              at org.jboss.resteasy.core.Resour
>> ceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)
>> >>              at org.jboss.resteasy.core.Resour
>> ceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)
>> >>              at org.jboss.resteasy.core.Resour
>> ceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)
>> >>              at org.jboss.resteasy.core.Resour
>> ceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)
>> >>              at org.jboss.resteasy.core.Resour
>> ceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)
>> >>              at org.jboss.resteasy.core.Resour
>> ceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)
>> >>              at org.jboss.resteasy.core.Synchr
>> onousDispatcher.invoke(SynchronousDispatcher.java:395)
>> >>              at org.jboss.resteasy.core.Synchr
>> onousDispatcher.invoke(SynchronousDispatcher.java:202)
>> >>              at org.jboss.resteasy.plugins.ser
>> ver.servlet.ServletContainerDispatcher.service(ServletContai
>> nerDispatcher.java:221)
>> >>              at org.jboss.resteasy.plugins.ser
>> ver.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>> >>              at org.jboss.resteasy.plugins.ser
>> ver.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>> >>              at javax.servlet.http.HttpServlet
>> .service(HttpServlet.java:790)
>> >>              at io.undertow.servlet.handlers.S
>> ervletHandler.handleRequest(ServletHandler.java:85)
>> >>              at io.undertow.servlet.handlers.F
>> ilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
>> >>              at org.keycloak.services.filters.
>> KeycloakSessionServletFilter.doFilter(KeycloakSessionServlet
>> Filter.java:90)
>> >>              at io.undertow.servlet.core.Manag
>> edFilter.doFilter(ManagedFilter.java:60)
>> >>              at io.undertow.servlet.handlers.F
>> ilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
>> >>              at io.undertow.servlet.handlers.F
>> ilterHandler.handleRequest(FilterHandler.java:84)
>> >>              at io.undertow.servlet.handlers.s
>> ecurity.ServletSecurityRoleHandler.handleRequest(ServletSecu
>> rityRoleHandler.java:62)
>> >>              at io.undertow.servlet.handlers.S
>> ervletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
>> >>              at org.wildfly.extension.undertow
>> .security.SecurityContextAssociationHandler.handleRequest(Se
>> curityContextAssociationHandler.java:78)
>> >>              at io.undertow.server.handlers.Pr
>> edicateHandler.handleRequest(PredicateHandler.java:43)
>> >>              at io.undertow.servlet.handlers.s
>> ecurity.SSLInformationAssociationHandler.handleRequest(SSLIn
>> formationAssociationHandler.java:131)
>> >>              at io.undertow.servlet.handlers.s
>> ecurity.ServletAuthenticationCallHandler.handleRequest(Servl
>> etAuthenticationCallHandler.java:57)
>> >>              at io.undertow.server.handlers.Pr
>> edicateHandler.handleRequest(PredicateHandler.java:43)
>> >>              at io.undertow.security.handlers.
>> AbstractConfidentialityHandler.handleRequest(AbstractConfide
>> ntialityHandler.java:46)
>> >>              at io.undertow.servlet.handlers.s
>> ecurity.ServletConfidentialityConstraintHandler.
>> handleRequest(ServletConfidentialityConstraintHandler.java:64)
>> >>              at io.undertow.security.handlers.
>> AuthenticationMechanismsHandler.handleRequest(Authentication
>> MechanismsHandler.java:60)
>> >>              at io.undertow.servlet.handlers.s
>> ecurity.CachedAuthenticatedSessionHandler.handleRequest(Cach
>> edAuthenticatedSessionHandler.java:77)
>> >>              at io.undertow.security.handlers.
>> NotificationReceiverHandler.handleRequest(NotificationReceiv
>> erHandler.java:50)
>> >>              at io.undertow.security.handlers.
>> AbstractSecurityContextAssociationHandler.handleRequest(Abst
>> ractSecurityContextAssociationHandler.java:43)
>> >>              at io.undertow.server.handlers.Pr
>> edicateHandler.handleRequest(PredicateHandler.java:43)
>> >>              at org.wildfly.extension.undertow
>> .security.jacc.JACCContextIdHandler.handleRequest(JACCContex
>> tIdHandler.java:61)
>> >>              at io.undertow.server.handlers.Pr
>> edicateHandler.handleRequest(PredicateHandler.java:43)
>> >>              at io.undertow.server.handlers.Pr
>> edicateHandler.handleRequest(PredicateHandler.java:43)
>> >>              at io.undertow.servlet.handlers.S
>> ervletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
>> >>              at io.undertow.servlet.handlers.S
>> ervletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
>> >>              at io.undertow.servlet.handlers.S
>> ervletInitialHandler.access$000(ServletInitialHandler.java:81)
>> >>              at io.undertow.servlet.handlers.S
>> ervletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
>> >>              at io.undertow.server.Connectors.
>> executeRootHandler(Connectors.java:202)
>> >>              at io.undertow.server.HttpServerE
>> xchange$1.run(HttpServerExchange.java:793)
>> >>              at java.util.concurrent.ThreadPoo
>> lExecutor.runWorker(ThreadPoolExecutor.java:1142)
>> >>              at java.util.concurrent.ThreadPoo
>> lExecutor$Worker.run(ThreadPoolExecutor.java:617)
>> >>              at java.lang.Thread.run(Thread.java:745)
>> >> Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can
>> not deserialize instance of java.util.ArrayList out of START_OBJECT token
>> >> at [Source: io.undertow.servlet.spec.ServletInputStreamImpl at 1a486a1f;
>> line: 1, column: 387] (through reference chain:
>> org.keycloak.representations.idm.ComponentRepresentation["co
>> nfig"]->org.keycloak.common.util.MultivaluedHashMap["priority"])
>> >>              at com.fasterxml.jackson.databind
>> .JsonMappingException.from(JsonMappingException.java:148)
>> >>              at com.fasterxml.jackson.databind
>> .DeserializationContext.mappingException(DeserializationContext.java:835)
>> >>              at com.fasterxml.jackson.databind
>> .DeserializationContext.mappingException(DeserializationContext.java:831)
>> >>              at com.fasterxml.jackson.databind
>> .deser.std.StringCollectionDeserializer.handleNonArray(Strin
>> gCollectionDeserializer.java:240)
>> >>              at com.fasterxml.jackson.databind
>> .deser.std.StringCollectionDeserializer.deserialize(StringCo
>> llectionDeserializer.java:171)
>> >>              at com.fasterxml.jackson.databind
>> .deser.std.StringCollectionDeserializer.deserialize(StringCo
>> llectionDeserializer.java:161)
>> >>              at com.fasterxml.jackson.databind
>> .deser.std.StringCollectionDeserializer.deserialize(StringCo
>> llectionDeserializer.java:19)
>> >>              at com.fasterxml.jackson.databind
>> .deser.std.MapDeserializer._readAndBindStringMap(MapDeserial
>> izer.java:485)
>> >>              at com.fasterxml.jackson.databind
>> .deser.std.MapDeserializer.deserialize(MapDeserializer.java:342)
>> >>              at com.fasterxml.jackson.databind
>> .deser.std.MapDeserializer.deserialize(MapDeserializer.java:26)
>> >>              at com.fasterxml.jackson.databind.
>> deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:523)
>> >>              at com.fasterxml.jackson.databind
>> .deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
>> >>              at com.fasterxml.jackson.databind.
>> deser.impl.BeanPropertyMap.findDeserializeAndSet(BeanProper
>> tyMap.java:285)
>> >>              at com.fasterxml.jackson.databind
>> .deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:248)
>> >>              at com.fasterxml.jackson.databind.deser.BeanDeserializer.
>> deserialize(BeanDeserializer.java:136)
>> >>              at com.fasterxml.jackson.databind
>> .ObjectReader._bind(ObjectReader.java:1410)
>> >>              at com.fasterxml.jackson.databind.ObjectReader.readValue(
>> ObjectReader.java:860)
>> >>              at org.jboss.resteasy.plugins.pro
>> viders.jackson.ResteasyJackson2Provider.readFrom(ResteasyJac
>> kson2Provider.java:121)
>> >>              at org.jboss.resteasy.core.interc
>> eption.AbstractReaderInterceptorContext.readFrom(AbstractRea
>> derInterceptorContext.java:61)
>> >>              at org.jboss.resteasy.core.interc
>> eption.ServerReaderInterceptorContext.readFrom(ServerReaderI
>> nterceptorContext.java:60)
>> >>              at org.jboss.resteasy.core.interc
>> eption.AbstractReaderInterceptorContext.proceed(AbstractRead
>> erInterceptorContext.java:53)
>> >>              at org.jboss.resteasy.security.do
>> seta.DigitalVerificationInterceptor.aroundReadFrom(DigitalVe
>> rificationInterceptor.java:34)
>> >>              at org.jboss.resteasy.core.interc
>> eption.AbstractReaderInterceptorContext.proceed(AbstractRead
>> erInterceptorContext.java:55)
>> >>              at org.jboss.resteasy.plugins.int
>> erceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZ
>> IPDecodingInterceptor.java:59)
>> >>              at org.jboss.resteasy.core.interc
>> eption.AbstractReaderInterceptorContext.proceed(AbstractRead
>> erInterceptorContext.java:55)
>> >>              at org.jboss.resteasy.core.Messag
>> eBodyParameterInjector.inject(MessageBodyParameterInjector.java:151)
>> >>              ... 48 more
>> >>
>> >>
>> >> Regards,
>> >> - Niko
>> >>
>> >>
>> >> _______________________________________________
>> >> keycloak-user mailing list
>> >> keycloak-user at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/keycloak-user
>> >
>> > _______________________________________________
>> > keycloak-user mailing list
>> > keycloak-user at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/keycloak-user
>>
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>>
>
>
>


More information about the keycloak-user mailing list