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 / 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;
@thomasdarimont
thomasdarimont / DemoResource.java
Created March 5, 2024 14:33
Reproducer for Quarkus Enhancement proposal https://github.com/quarkusio/quarkus/issues/31497 with Resteasy Reactive
package demo;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.container.ResourceContext;
import jakarta.ws.rs.core.Context;
@Path("/resource")
public class DemoResource {

Because of Arjuna timeout / closing the connection after 5 mins, setting following additional JAVA_OPTS might help:

-Dquarkus.transaction-manager.default-transaction-timeout=3600
-Dkeycloak.migration.batch-enabled=true
-Dkeycloak.migration.batch-size=1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Acme Mini SPA</title>
<style>
body {
background-color: #eaeaea;