Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Thomas Darimont thomasdarimont

🏠
Working from home
View GitHub Profile
@thomasdarimont
thomasdarimont / readme.md
Created Aug 7, 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 nun 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;
@thomasdarimont
thomasdarimont / main.rs
Created Jun 9, 2020
Rust experiments: Calculator
View main.rs
use core::fmt;
use std::io::{self, Write};
#[derive(Debug, Clone, Copy)]
enum BinaryOperator {
ADD,
SUB,
MUL,
DIV,
MOD,
@thomasdarimont
thomasdarimont / readme.md
Created May 27, 2020
Docker Oracle Database
View readme.md
@thomasdarimont
thomasdarimont / readme.md
Last active May 23, 2020
Create a trimmed down JDK with support for remote debugging, full jmx support that can run Wildfly / Keycloak
View readme.md
JAVA_TARGET=$PWD/java-runtime

echo "Create trimmed down JDK" && \
      $JAVA_HOME/bin/jlink \
      --no-header-files \
      --no-man-pages \
      --compress=2 \
      --vm=server \
      --exclude-files="**/bin/rmiregistry,**/bin/jrunscript,**/bin/rmid" \
@thomasdarimont
thomasdarimont / AcmeUserAttributeMapper.java
Created May 19, 2020
Custom UserAttributeMapper that skips expensive Group Attribute resolving, which is not used by Acme Keycloak.
View AcmeUserAttributeMapper.java
import org.keycloak.models.ProtocolMapperModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.UserSessionModel;
import org.keycloak.protocol.ProtocolMapperUtils;
import org.keycloak.protocol.oidc.mappers.OIDCAttributeMapperHelper;
import org.keycloak.protocol.oidc.mappers.UserAttributeMapper;
import org.keycloak.representations.IDToken;
import java.util.Collection;
import java.util.HashSet;
@thomasdarimont
thomasdarimont / readme.md
Last active May 21, 2020
How to enable OpenTracing in Keycloak 10.x
View readme.md

How enable Micro Profile OpenTracing in Keycloak 10.x

Keycloak 10.0.1 is based on Wildfly 19 which comes with support for OpenTracing. However the OpenTracing support in Keycloak is not active by default. This small example demonstrates how to enable OpenTracing in the latest Keycloak version based on the article Micro_Profile_OpenTracing_Comes_To_WildFly

This example tries to explore a solution for KEYCLOAK-8288.

@thomasdarimont
thomasdarimont / readme.md
Created May 10, 2020
Linux create RAM Disk
View readme.md

Create and mount RAM disk

mkdir -p /tmp/build
sudo mount -t tmpfs -o size=512M tmpfs /tmp/build

Unmount RAM disk

sudo umount /tmp/build
You can’t perform that action at this time.