Skip to content

Paclet to connect to Keycloak APIs using Wolfram Language

License

Notifications You must be signed in to change notification settings

bignyap/KeycloakLink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KeycloakLink

Paclet to connect to Keycloak APIs using Wolfram Language

How to Run

Load the Required Paclets

First, install and load the necessary paclets:

PacletInstall["WTC/Utilities"]
PacletDirectoryLoad["<path/to/your/paclet/folder>"];
Get["KeycloakLink`"];

Establish a Connection

Open a connection to your Keycloak server:

conn = OpenKeycloakConnection[
    "https://localhost:8443", "master", 
    Authentication -> <|
        "grant_type" -> "password",
        "auth_details" -> <|
            "username" -> "******",
            "password" -> "******",
            "client_id" -> "******",
            "client_secret" -> "******"
        |>,
        "scope" -> "openid roles profile"
    |>
]

Connection Properties

Retrieve various properties of the connection:

conn["Properties"]
conn["ID"]
conn["Requests"]
conn["Authentication"]

Execute Keycloak Commands

List all realms:

KeycloakExecute[conn, "ListRealm"]

Create a new realm:

KeycloakExecute[conn, "CreateRealm", "Body" -> ToJSON[<|"realm" -> "test1234", "enabled" -> True|>]]

Get client scope for a specific realm:

KeycloakExecute[conn, "GetClientScope", "DynamicPath" -> <|"realm" -> "test1234"|>]

Execute a command with token refresh:

KeycloakExecuteWithRefresh[conn, "GetClientScope", "DynamicPath" -> <|"realm" -> "test1234"|>]

Delete a realm:

KeycloakExecuteWithRefresh[conn, "DeleteRealm", "DynamicPath" -> <|"realm" -> "test1234"|>]

Verify JWT Token:

KeycloakLink`Common`ParseJWTToken[conn["TokenDetails"]["access_token"], "VerifySignature" -> True, "Issuer" -> "https://localhost"]

About

Paclet to connect to Keycloak APIs using Wolfram Language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published