Search in sources :

Example 1 with KeycloakSpringBootConfigResolver

use of org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver in project vboard by voyages-sncf-technologies.

the class WebSecurityConfig method adapterDeploymentContext.

// Also injected in `KeycloakPreAuthActionsFilter` as the `deploymentContext` property through the `initFilterBean` method.
// !BEWARE! if this `deploymentContext` property ends up null, it will lead to a NullPointerException in `org.keycloak.adapters.PreAuthActionsHandler.preflightCors:107`
@Bean
@Conditional(KeycloakEnabledInEnv.class)
public static AdapterDeploymentContext adapterDeploymentContext() throws Exception {
    AdapterDeploymentContextFactoryBean factoryBean = new AdapterDeploymentContextFactoryBean(new KeycloakSpringBootConfigResolver());
    // creates the AdapterDeploymentContext
    factoryBean.afterPropertiesSet();
    return factoryBean.getObject();
}
Also used : KeycloakSpringBootConfigResolver(org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver) AdapterDeploymentContextFactoryBean(org.keycloak.adapters.springsecurity.AdapterDeploymentContextFactoryBean) Conditional(org.springframework.context.annotation.Conditional) AdapterDeploymentContextFactoryBean(org.keycloak.adapters.springsecurity.AdapterDeploymentContextFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

KeycloakSpringBootConfigResolver (org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver)1 AdapterDeploymentContextFactoryBean (org.keycloak.adapters.springsecurity.AdapterDeploymentContextFactoryBean)1 Bean (org.springframework.context.annotation.Bean)1 Conditional (org.springframework.context.annotation.Conditional)1