Skip to content

Instantly share code, notes, and snippets.

View thomasdarimont's full-sized avatar
🏠
Working from home

Thomas Darimont thomasdarimont

🏠
Working from home
View GitHub Profile
@thomasdarimont
thomasdarimont / custom-login.css
Last active July 19, 2024 10:10
Custom footer with custom theme based on keycloak.v2/login
#kc-login-footer-links {
text-align: center;
}
#kc-login-footer-links li{
display:inline-block;
}
@thomasdarimont
thomasdarimont / footer.ftl
Last active July 18, 2024 13:08
Keycloak Login template.ftl with support for footer macros
@thomasdarimont
thomasdarimont / DataSourceProvider.java
Last active July 4, 2024 11:38
Example for using datasource_injecter_class in with Keycloak 25.0.1, JGroups 5.3.7 and JDBC_PING
package org.keycloak.support.jgroups;
import jakarta.enterprise.inject.spi.CDI;
import org.jboss.logging.Logger;
import org.jgroups.protocols.JDBC_PING;
import javax.sql.DataSource;
import java.util.function.Function;
public class DataSourceProvider implements Function<JDBC_PING, DataSource> {
@thomasdarimont
thomasdarimont / GetMethodSourceDemo.java
Last active July 1, 2024 08:18
PoC for fetching the Java source code of an artifact from a maven repository
package demo;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.MethodDeclaration;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
@thomasdarimont
thomasdarimont / docker-compose.yml
Last active June 26, 2024 19:57
Keycloak KrankenD cookie_key PoC
services:
krakend:
image: devopsfaith/krakend:2.6
ports:
- "8080:8080"
volumes:
- ./krankend/krakend.json:/etc/krakend/krakend.json
keycloak:
image: quay.io/keycloak/keycloak:25.0.1
@thomasdarimont
thomasdarimont / ExampleResource.java
Created June 7, 2024 13:08
Quarkus app prints wrong error message when run with quarkus:dev and another application is already using port 8080
package org.example;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
@Path("/hello")
public class ExampleResource {
package com.github.thomasdarimont.keycloak.custom.oidc.introspection;
import com.google.auto.service.AutoService;
import jakarta.ws.rs.core.Response;
import lombok.extern.jbosslog.JBossLog;
import org.keycloak.events.EventBuilder;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.UserModel;
import org.keycloak.protocol.oidc.AccessTokenIntrospectionProvider;
import org.keycloak.protocol.oidc.AccessTokenIntrospectionProviderFactory;
@thomasdarimont
thomasdarimont / GreetingResource.java
Last active May 2, 2024 21:03
Reproducer for Quarkus Bug GH-40420 "io.quarkus.runtime.RuntimeValue.getValue()" because "frameworkRouter" is null
package org.acme;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
@Path("/hello")
public class GreetingResource {
@thomasdarimont
thomasdarimont / offline_client_session.json
Created April 18, 2024 10:36
Stored information for a transient-user with --features=preview,transient-users,persistent-user-sessions-no-cache,persistent-user-sessions in Keycloak 25.0.0 (2c069433f9)
{
"authMethod": "openid-connect",
"redirectUri": "http://localhost:8080/admin/master/console/#/company-apps/groups",
"notes": {
"clientId": "7365e17b-b9d8-4553-8bf3-0aefddae464b",
"iss": "http://localhost:8080/realms/master",
"startedAt": "1713429283",
"response_type": "code",
"level-of-authentication": "-1",
"code_challenge_method": "S256",
@thomasdarimont
thomasdarimont / FedCmResource.java
Last active April 12, 2024 10:53
PoC for Federated Credential Management API support in Keycloak
package com.thomasdarimont.training.keycloak.endpoints;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;