[keycloak-user] keycloak 4.5 client integration with spring boot and spring security problem

ZKX z_88 at yahoo.com
Wed Oct 10 11:39:13 EDT 2018


Just found I forgot to cc the mailing list the reply below:
---------------------------------------------Thanks Pedro.   Somehow I missed that thread. 
Could you please share more details about the SimpleKeycloakSpringBootConfigResolver mentioned in https://issues.jboss.org/browse/KEYCLOAK-8444 ?
I tried something like: public class SimpleKeycloakSpringBootConfigResolver implements KeycloakConfigResolver{ ...  @Override    public KeycloakDeployment resolve(HttpFacade.Request request)    {        if (keycloakProperties != null)   {            return KeycloakDeploymentBuilder.build(keycloakProperties);        } else {            return null;        }    }}
But still get "Requested bean is currently in creation error".
Thanks.


    On Thursday, October 4, 2018 2:45 PM, Pedro Igor Silva <psilva at redhat.com> wrote:
 

 Hi,
Please, see http://lists.jboss.org/pipermail/keycloak-user/2018-September/015688.html. I'm working in a fix, right now.
Regards.Pedro Igor
On Thu, Oct 4, 2018 at 1:43 PM ZKX <z_88 at yahoo.com> wrote:

We are doing a POC with a spring boot/security project with keycloak. 
Initially we only had keycloak-spring-boot-starter without directly reference with spring security. It is very straightforward with just setting the keycloak properties in the application.properties file.
Later on we need to use @PreAuthorize("hasRole('admin')") to enforce security check on some services, therefore, we added spring security library with additional security configuration:
as mentioned in the keycloak document.  Mostly as the described in this tutorial: https://www.baeldung.com/spring-boot-keycloak
Everything works fine with keycloak 4.3/4.4, we still can use the keycloak config in application.properties file together with spring security, since we had following code in our spring boot configuration:    @Bean    public KeycloakSpringBootConfigResolver KeycloakConfigResolver() {        return new KeycloakSpringBootConfigResolver();    }
However, recently we upgrade our spring boot keycloak starter to 4.5, and our application failed to start with following error:
Error creating bean with name 'KeycloakSpringBootConfigResolver': Requested bean is currently in creation: Is there an unresolvable circular reference?

Just wondering how to resolve this?Anyone use spring boot with spring security together with keycloak starter 4.5 successfully? 
Thanks,Kevin
_______________________________________________
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