This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
USAGE: | |
1) Create client in Keycloak and enable client authentication + service account roles for it | |
2) Assign "view-realm" role from realm-management client on "service account roles" tab for the client | |
3) Replace keycloak_url and realm_name variables with your Keycloak base dir | |
4) Export client credentials into $CLIENTID and CLIENTSECRET env variable | |
5) python get-keycloak-active-sessions.py | |
''' | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
volumes: | |
mssql_data: | |
driver: local | |
caddy_data: | |
driver: local | |
services: | |
mssql: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.2 | |
info: | |
title: Keycloak Account API | |
version: 20.0.3 | |
description: | | |
Derived from the code at https://github.com/keycloak/keycloak/blob/main/services/src/main/java/org/keycloak/services/resources/account/AccountRestService.java | |
components: | |
securitySchemes: | |
access_token: | |
type: http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read -p 'Host (format https://euc1.auth.ac ): ' host | |
read -p 'Realm: ' realm | |
printf "\nThis user must have create-organization, manage-organizations, and view-organizations realm-management roles in order to create and manage new Organizations.\n"read -p 'Username: ' user | |
read -p 'Username: ' user | |
read -sp 'Password: ' pass | |
DIRECT_GRANT_RESPONSE=$(curl -i --request POST $host/auth/realms/$realm/protocol/openid-connect/token --header "Accept: application/json" --header "Content-Type: application/x-www-form-urlencoded" --data "grant_type=password&username=$user&password=$pass&client_id=admin-cli") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM quay.io/keycloak/keycloak:17.0.0 as builder | |
ENV KC_METRICS_ENABLED=true | |
ENV KC_FEATURES=preview | |
ENV KC_DB=postgres | |
ENV KC_HTTP_RELATIVE_PATH=/auth | |
# specify the custom cache config file here | |
ENV KC_CACHE_CONFIG_FILE=cache-ispn-jdbc-ping.xml | |
# copy the custom cache config file into the keycloak conf dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.hamcrest.CoreMatchers.*; | |
import static org.junit.Assert.*; | |
import org.junit.BeforeClass; | |
import org.junit.ClassRule; | |
import org.junit.Test; | |
import org.keycloak.admin.client.Keycloak; | |
import org.keycloak.representations.idm.RealmRepresentation; | |
public class ExampleTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import se.akerfeldt.okhttp.signpost.OkHttpOAuthConsumer; | |
import se.akerfeldt.okhttp.signpost.SigningInterceptor; | |
.... | |
// Using the default Java | |
DefaultApi api = new DefaultApi(); | |
ApiClient client = api.getApiClient(); | |
// Put the interceptor in the http client | |
OkHttpClient http = client.getHttpClient(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '==================================================' | |
echo '===============Install necessary tools===============' | |
echo '==================================================' | |
sudo yum update | |
sudo yum install git make flex bison libtool automake openssl-devel libevent libevent-devel python-devel gcc-c++ byacc java-1.7.0-openjdk ant | |
echo '==================================================' |