Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Thomas Darimont thomasdarimont

🏠
Working from home
View GitHub Profile
@thomasdarimont
thomasdarimont / index.html
Created Dec 16, 2020
Simple example for a SPA with Keycloak.js
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Keycloak JS Demo</title>
<style>
body {
@thomasdarimont
thomasdarimont / readme.md
Last active Oct 17, 2020
Run a jshell instance with a classpath derived from maven pom.xml file
View readme.md

Linux / OSX

Note that this example uses sdkman.

CP=$(mktemp) && \
mvn dependency:build-classpath -Dmdep.includeScope=compile -Dmdep.outputFile=$CP -q -f ./pom.xml && \
CP=$(cat $CP) && \
$(sdk home java 11.0.8.hs-adpt)/bin/jshell --class-path $CP
@thomasdarimont
thomasdarimont / TableDrivenTest.java
Last active Oct 2, 2020
Go like table-driven tests with JUnit5 and local records
View TableDrivenTest.java
package wb.junit5.tabledriven;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.RecordComponent;
@thomasdarimont
thomasdarimont / readme.md
Last active Sep 24, 2020
graalvm-js Dependencies
View readme.md
[INFO] org.example:graalvm-js-scripting:jar:1.0-SNAPSHOT
[INFO] +- org.graalvm.js:js:jar:20.2.0:compile
[INFO] |  +- org.graalvm.regex:regex:jar:20.2.0:compile
[INFO] |  +- org.graalvm.truffle:truffle-api:jar:20.2.0:compile
[INFO] |  +- org.graalvm.sdk:graal-sdk:jar:20.2.0:compile
[INFO] |  +- org.ow2.asm:asm:jar:7.1:compile
[INFO] |  +- org.ow2.asm:asm-tree:jar:7.1:compile
[INFO] |  +- org.ow2.asm:asm-analysis:jar:7.1:compile
@thomasdarimont
thomasdarimont / index.html
Last active Sep 23, 2020
Speak Java Prototype
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SpeakJava</title>
<link href="//cdnjs.cloudflare.com/ajax/libs/prism/1.21.0/themes/prism.css" rel="stylesheet" />
@thomasdarimont
thomasdarimont / readme.md
Created Sep 8, 2020
kcadm example snippets
View readme.md
@thomasdarimont
thomasdarimont / readme.md
Last active Aug 24, 2020
Keycloak Profile SPI Feedback
View readme.md

Hallo zusammen,

ich habe mich heute Abend mal hingesetzt und euren Branch ... auf den aktuellen Keycloak master rebased und zur Integration einen neuen Branch erstellt: Danach habe ich die Commits aus meinem validation-spi Branch in einen commit gesquashed und cherry-picked.

Der Branch kompiliert nun und kann als Grundlage für einen experimentiellen Umbau dienen. Ich denke wir sollten uns dazu nochmal abstimmen und ggf. ne Pairing-Session machen.

Ich denke mittlerweile, dass man über 80% euerer Klassen mit dem generischen Validation SPI ersetzen kann.

@thomasdarimont
thomasdarimont / DemoUserStorageProvider.java
Created Jul 16, 2020
PoC for exposing custom attributes and error messages in Keycloak login form
View DemoUserStorageProvider.java
package demo.userstorage.demouserstorage;
import lombok.extern.jbosslog.JBossLog;
import org.jboss.resteasy.spi.HttpRequest;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import org.keycloak.authentication.AuthenticationFlowError;
import org.keycloak.authentication.AuthenticationFlowException;
import org.keycloak.component.ComponentModel;
import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialInputUpdater;
@thomasdarimont
thomasdarimont / Main.java
Created Jun 26, 2020
Embedded Keycloak Spring Boot Starter example
View Main.java
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) {
@thomasdarimont
thomasdarimont / DynamicIdpRedirectAuthenticator.java
Last active Jun 22, 2020
DynamicIdpRedirectAuthenticator with configurable fallback
View DynamicIdpRedirectAuthenticator.java
package com.github.thomasdarimont.keycloak.auth.dynamicidp;
import lombok.extern.jbosslog.JBossLog;
import org.keycloak.OAuth2Constants;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError;
import org.keycloak.authentication.Authenticator;
import org.keycloak.constants.AdapterConstants;
import org.keycloak.events.Errors;
import org.keycloak.models.AuthenticatorConfigModel;