Skip to content

Instantly share code, notes, and snippets.

View fnbk's full-sized avatar
💭
I may be slow to respond.

Florian Böhmak fnbk

💭
I may be slow to respond.
View GitHub Profile
# copy file from container to your host system
docker cp 70e320193513:/tmp/export.json export.json
# login to your running keycloak container instance
docker exec -it 70e320193513 bash
# inside the container:
/opt/jboss/keycloak/bin/standalone.sh \
-Djboss.socket.binding.port-offset=100 \
-Dkeycloak.migration.action=export \
-Dkeycloak.migration.provider=singleFile \
-Dkeycloak.migration.realmName=master \
-Dkeycloak.migration.usersExportStrategy=REALM_FILE \
# start keycloak
docker run --publish 8080:8080 jboss/keycloak:11.0.2
# set up initial user
docker exec 70e320193513 /opt/jboss/keycloak/bin/add-user-keycloak.sh -u admin -p admin
docker restart 70e320193513
apiVersion: apps/v1
kind: Deployment
metadata:
name: traefik
spec:
replicas: 1
selector:
matchLabels:
app: traefik
release: traefik
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: whoami
spec:
entryPoints:
- websecure
routes:
- match: Host(`example.com`) && PathPrefix(/whoami`)
kind: Rule
@fnbk
fnbk / GetComputerV3.cs
Created August 17, 2022 13:18
Step Three: Improve Collaboration
public enum SearchType
{
GUID = 1,
ID = 2,
NAME = 3,
UNDEFINED = 0
}
public Computer GetComputer(string search)
{
@fnbk
fnbk / GetComputerV2.cs
Created August 17, 2022 13:13
Step Two: Apply Separation of Concerns (SoC)
public Computer GetComputer(string search)
{
//
// guard
//
if (search is null)
{
return null;
}
@fnbk
fnbk / GetComputerV1.cs
Created August 17, 2022 13:08
Step One: write it down as it comes to mind
public Computer GetComputer(string search)
{
Computer computer = null;
if (search is null)
search = string.Empty;
if (search.ToUpper().StartsWith("GUID:") && search.Length >= 6 && Guid.TryParse(search.Substring(5), out Guid newGuid))
{
computer = GetComputerByGUID(search);
if (computer == null)
#
# functions
#
Function Edit-Hosts {
# execute notepad++ in elevated mode
Start-Process C:\"Program Files"\Notepad++\notepad++.exe -Verb runAs -ArgumentList c:\Windows\System32\Drivers\etc\hosts
}
@fnbk
fnbk / service-account-role-mappings.js
Created April 29, 2021 08:59
Keycloak Service Account Role Mappings
import keycloak from 'keycloak-admin';
//
// init
//
const kcAdminClient = new keycloak.default({
baseUrl: 'https://demo.com/auth',
realmName: 'master'
});