Merge pull request #4098 from ahus1/KEYCLOAK-4814-disable-keycloak-spring-boot-by-configuration
KEYCLOAK-4814 disable keycloak spring boot by configuration
This commit is contained in:
commit
63c237423d
2 changed files with 15 additions and 0 deletions
|
@ -33,6 +33,7 @@ import org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve;
|
||||||
import org.keycloak.adapters.undertow.KeycloakServletExtension;
|
import org.keycloak.adapters.undertow.KeycloakServletExtension;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
|
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
|
||||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
|
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
|
||||||
|
@ -60,6 +61,7 @@ import java.util.Set;
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnWebApplication
|
@ConditionalOnWebApplication
|
||||||
@EnableConfigurationProperties(KeycloakSpringBootProperties.class)
|
@EnableConfigurationProperties(KeycloakSpringBootProperties.class)
|
||||||
|
@ConditionalOnProperty(value = "keycloak.enabled", matchIfMissing = true)
|
||||||
public class KeycloakAutoConfiguration {
|
public class KeycloakAutoConfiguration {
|
||||||
|
|
||||||
private KeycloakSpringBootProperties keycloakProperties;
|
private KeycloakSpringBootProperties keycloakProperties;
|
||||||
|
|
|
@ -34,6 +34,11 @@ public class KeycloakSpringBootProperties extends AdapterConfig {
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private Map config = new HashMap();
|
private Map config = new HashMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow enabling of Keycloak Spring Boot adapter by configuration.
|
||||||
|
*/
|
||||||
|
private boolean enabled = true;
|
||||||
|
|
||||||
public Map getConfig() {
|
public Map getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +48,14 @@ public class KeycloakSpringBootProperties extends AdapterConfig {
|
||||||
*/
|
*/
|
||||||
private List<SecurityConstraint> securityConstraints = new ArrayList<SecurityConstraint>();
|
private List<SecurityConstraint> securityConstraints = new ArrayList<SecurityConstraint>();
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This matches security-constraint of the servlet spec
|
* This matches security-constraint of the servlet spec
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue