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 / KeycloakAdminClientExample.java
Last active April 23, 2024 09:02
Using Keycloak Admin Client to create user with roles (Realm and Client level)
package demo.plain;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.CreatedResponseUtil;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.ClientRepresentation;
@thomasdarimont
thomasdarimont / TableDrivenTest.java
Last active April 22, 2024 08:47
Go like table-driven tests with JUnit5 and local records
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 / 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 / readme.md
Created August 6, 2019 21:01
Keycloak Secure Admin Console via TLS Certificate
@thomasdarimont
thomasdarimont / app.py
Last active April 16, 2024 08:33
Simple python example using flask, flask_oidc and keycloak
import json
import logging
from flask import Flask, g
from flask_oidc import OpenIDConnect
import requests
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@thomasdarimont
thomasdarimont / Readme.md
Last active April 15, 2024 23:29
Call stored procedure with ref-cursor mode as out parameter via Spring Data JPA and eclipse-link.

Run with:

-javaagent:/Users/tom/.m2/repository/org/springframework/spring-instrument/4.1.4.RELEASE/spring-instrument-4.1.4.RELEASE.jar
@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 / spinning-cube.html
Last active April 10, 2024 20:45
Spinning Cube with HTML5, Canvas, JS
<!doctype html>
<html>
<head>
<title>Spinning Cube</title>
<script type="text/javascript">
function Point3D(x,y,z) {
this.x = x;
@thomasdarimont
thomasdarimont / index.html
Last active April 8, 2024 14:10
Mini SPA with Keycloak.js with support for PKCE and RAR
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Keycloak SPA Demo</title>
<style>
body {
@thomasdarimont
thomasdarimont / App.java
Created June 19, 2015 14:45
Spring Boot Redis custom json serializer example.
package demo;
import java.io.Serializable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisOperations;