Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Embedded Keycloak Spring Boot Starter example
spring:
datasource:
username: sa
url: jdbc:h2:./data/keycloak;DB_CLOSE_ON_EXIT=FALSE
hikari:
maximum-pool-size: 25
minimum-idle: 1
server:
# forward-headers-strategy: native
port: 8080
servlet:
context-path: "/"
logging:
level:
org.jgroups: INFO
org.infinispan: INFO
org.keycloak: INFO
org.keycloak.services.managers.DefaultBruteForceProtector: DEBUG
org.keycloak.services.scheduled.ClusterAwareScheduledTaskRunner: DEBUG
org.keycloak.services.managers.UserSessionManager: DEBUG
org.keycloak.timer.basic: DEBUG
resteasy:
deployment:
async_job_service_enabled: true
keycloak:
custom:
server:
keycloak-path: "/auth"
adminUser:
username: admin
password: admin
create-admin-user-enabled: true
migration:
importProvider: singleFile
importLocation: keycloak-realm-config.json
# -Dkeycloak.migration.strategy=OVERWRITE_EXISTING
# -Dkeycloak.migration.strategy=IGNORE_EXISTING
hostname:
provider: "default"
default:
frontendUrl: ""
adminUrl: ""
forceBackendUrlToFrontendUrl: false
admin:
realm: "master"
eventsStore:
provider: "jpa"
eventsListener:
"jboss-logging":
"success-level": "info"
"error-level": "warn"
realm:
provider: "jpa"
user:
provider: "jpa"
userFederatedStorage:
provider: "jpa"
userSessionPersister:
provider: "jpa"
authorizationPersister:
provider: "jpa"
userCache:
default:
enabled: true
timer:
provider: "basic"
theme:
staticMaxAge: "2592000"
cacheTemplates: true
cacheThemes: true
folder:
dir: ""
scheduled:
interval: 900
connectionsHttpClient:
default: {}
connectionsJpa:
provider: "default"
default:
dataSource: "spring/datasource"
initializeEmpty: true
migrationStrategy: "update"
showSql: false
formatSql: true
globalStatsInterval: -1
realmCache:
default:
enabled: true
connectionsInfinispan:
default:
jgroupsUdpMcastAddr: "234.56.78.90"
nodeName: "localhost"
siteName: ""
clustered: fase
async: false
sessionsOwners: 1
l1Lifespan: 600000
remoteStoreEnabled: false
remoteStoreHost: "localhost"
remoteStorePort: 11222
hotrodProtocolVersion: ""
scripting: {}
"jta-lookup":
provider: "jboss"
jboss:
enabled: true
"login-protocol":
"saml":
"knownProtocols": ["http=${server.port}", "https=${server.port}"]
"x509cert-lookup":
provider: "default"
default:
enabled: true
haproxy:
enabled: true
sslClientCert: "x-ssl-client-cert"
sslCertChainPrefix: "x-ssl-client-cert-chain"
certificateChainLength: 1
apache:
enabled: true
sslClientCert: "x-ssl-client-cert"
sslCertChainPrefix: "x-ssl-client-cert-chain"
certificateChainLength: 1
nginx:
enabled: true
sslClientCert: "x-ssl-client-cert"
sslCertChainPrefix: "x-ssl-client-cert-chain"
certificateChainLength: 1
package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
@SpringBootApplication(exclude = LiquibaseAutoConfiguration.class)
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>keycloak-jitpack-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
</properties>
<dependencies>
<dependency>
<groupId>com.github.thomasdarimont.embedded-spring-boot-keycloak-server</groupId>
<artifactId>embedded-keycloak-server-spring-boot-starter</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.