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

Bill Burke bburke at redhat.com
Thu Nov 3 13:21:11 EDT 2016


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 
> <mailto: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
>     <mailto: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/components/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["config"]->org.keycloak.common.util.MultivaluedHashMap["priority"])
>     >>              at
>     org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:184)
>     >>              at
>     org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:91)
>     >>              at
>     org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:114)
>     >>              at
>     org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
>     >>              at
>     org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
>     >>              at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)
>     >>              at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)
>     >>              at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)
>     >>              at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)
>     >>              at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)
>     >>              at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)
>     >>              at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>     >>              at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>     >>              at
>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>     >>              at
>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>     >>              at
>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>     >>              at
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
>     >>              at
>     io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
>     >>              at
>     io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
>     >>              at
>     org.keycloak.services.filters.KeycloakSessionServletFilter.doFilter(KeycloakSessionServletFilter.java:90)
>     >>              at
>     io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
>     >>              at
>     io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
>     >>              at
>     io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
>     >>              at
>     io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
>     >>              at
>     io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
>     >>              at
>     org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
>     >>              at
>     io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>     >>              at
>     io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
>     >>              at
>     io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
>     >>              at
>     io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>     >>              at
>     io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
>     >>              at
>     io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
>     >>              at
>     io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
>     >>              at
>     io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
>     >>              at
>     io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
>     >>              at
>     io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
>     >>              at
>     io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>     >>              at
>     org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
>     >>              at
>     io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>     >>              at
>     io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>     >>              at
>     io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
>     >>              at
>     io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
>     >>              at
>     io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
>     >>              at
>     io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
>     >>              at
>     io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
>     >>              at
>     io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
>     >>              at
>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>     >>              at
>     java.util.concurrent.ThreadPoolExecutor$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["config"]->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(StringCollectionDeserializer.java:240)
>     >>              at
>     com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:171)
>     >>              at
>     com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:161)
>     >>              at
>     com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:19)
>     >>              at
>     com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringMap(MapDeserializer.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(BeanPropertyMap.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.providers.jackson.ResteasyJackson2Provider.readFrom(ResteasyJackson2Provider.java:121)
>     >>              at
>     org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:61)
>     >>              at
>     org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:60)
>     >>              at
>     org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
>     >>              at
>     org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor.aroundReadFrom(DigitalVerificationInterceptor.java:34)
>     >>              at
>     org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:55)
>     >>              at
>     org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59)
>     >>              at
>     org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:55)
>     >>              at
>     org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:151)
>     >>              ... 48 more
>     >>
>     >>
>     >> Regards,
>     >> - Niko
>     >>
>     >>
>     >> _______________________________________________
>     >> keycloak-user mailing list
>     >> keycloak-user at lists.jboss.org
>     <mailto:keycloak-user at lists.jboss.org>
>     >> https://lists.jboss.org/mailman/listinfo/keycloak-user
>     <https://lists.jboss.org/mailman/listinfo/keycloak-user>
>     >
>     > _______________________________________________
>     > keycloak-user mailing list
>     > keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
>     > https://lists.jboss.org/mailman/listinfo/keycloak-user
>     <https://lists.jboss.org/mailman/listinfo/keycloak-user>
>
>     _______________________________________________
>     keycloak-user mailing list
>     keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/keycloak-user
>     <https://lists.jboss.org/mailman/listinfo/keycloak-user>
>
>



More information about the keycloak-user mailing list