Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-6163

Unable to disable Keycloak springboot adapter

    XMLWordPrintable

Details

    • NEW
    • NEW

    Description

      Using Springboot 1.5.9

      keycloak.enabled=true

      works fine but

      keycloak.enabled=false

      results in a stack trace...

      java.lang.NullPointerException: null
      at org.keycloak.adapters.KeycloakDeploymentBuilder.internalBuild(KeycloakDeploymentBuilder.java:55)
      at org.keycloak.adapters.KeycloakDeploymentBuilder.build(KeycloakDeploymentBuilder.java:164)
      at org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver.resolve(KeycloakSpringBootConfigResolver.java:37)
      at org.keycloak.adapters.AdapterDeploymentContext.resolveDeployment(AdapterDeploymentContext.java:88)
      at org.keycloak.adapters.PreAuthActionsHandler.preflightCors(PreAuthActionsHandler.java:107)
      at org.keycloak.adapters.PreAuthActionsHandler.handleRequest(PreAuthActionsHandler.java:79)
      at org.keycloak.adapters.springsecurity.filter.KeycloakPreAuthActionsFilter.doFilter(KeycloakPreAuthActionsFilter.java:81)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
      at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
      at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)

      I think it is related to the following line in org.keycloak.adapters.springboot.KeycloakAutoConfiguration

      @ConditionalOnProperty(value = "keycloak.enabled", matchIfMissing = true)

      When keycloak.enabled = false then this annotation will cause the bean to not be instantiated which means that a null value is passed resulting, eventually, in the above exception.

      Attachments

        Issue Links

          Activity

            People

              sebastienblanc Sebastien Blanc (Inactive)
              aharris_jira Andrew Harris (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: