[keycloak-dev] Authorization with Springboot adapter

Pedro Igor Silva psilva at redhat.com
Thu May 18 08:34:23 EDT 2017


We are really missing examples and documentation to Spring Boot Adapter.
Will write an example/template and review docs.

Can give you an answer right now because I've tested authz with spring boot
only a very few times. But you should not get this error at all.

Will have something today.



On Thu, May 18, 2017 at 3:17 AM, Crafton Williams <
crafton.williams at qut.edu.au> wrote:

> Hi All:
>
> I’m trying to configure a basic springboot app using the springboot
> keycloak adapter. Authentication works as expected but I’m a bit confused
> as to how to configure the policy enforcer in yaml. The documentation shows
> configuring the policy-enforcer as a json document however the springboot
> config implies a only policy-enforcer-config. In any case, I did try the
> json doc but it wasn’t picked up by the adapter.
>
> I’m using 3.0.0.Final and tried the following in my yaml file(omitted the
> rest of the path info for brevity):
>
> Policy-enforcer-config:
>   Enforcement-mode: ENFORCING
>   paths:
>
>   *   name: blah
>
> The exception I got was:
>
> org.springframework.context.ApplicationContextException: Unable to start
> embedded container; nested exception is org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'tomcatEmbeddedServletContainerFactory'
> defined in class path resource [org/springframework/boot/
> autoconfigure/web/EmbeddedServletContainerAutoCo
> nfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested
> exception is org.springframework.beans.factory.
> UnsatisfiedDependencyException: Error creating bean with name
> 'org.keycloak.adapters.springboot.KeycloakSpringBootConfiguration':
> Unsatisfied dependency expressed through method '
> setKeycloakSpringBootProperties' parameter 0; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'keycloak-org.keycloak.adapters.springboot.KeycloakSpringBootProperties':
> Could not bind properties to KeycloakSpringBootProperties (prefix=keycloak,
> ignoreInvalidFields=false, ignoreUnknownFields=false,
> ignoreNestedProperties=false); nested exception is
> org.springframework.beans.InvalidPropertyException: Invalid property
> 'policyEnforcerConfig.paths[0]' of bean class [org.keycloak.adapters.
> springboot.KeycloakSpringBootProperties]: Illegal attempt to get property
> 'paths' threw exception; nested exception is java.lang.
> UnsupportedOperationException
>
> Is there an example project somewhere that can guide me in configuring the
> policy enforcer for the springboot adapter?
>
> Cheers,
>
> Crafton
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>


More information about the keycloak-dev mailing list