class Keycloak::Client

Overview

The client has to be used by a correctly configured Keycloak Client. The client needs to have enabled service account capalibity:

Client Config

Depending on the desired funcations the respective roles have to be assigned to the client, in this example the user and grou roles are maked yellow for easier visibility:

Client Roles

Included Modules

Defined in:

keycloak.cr

Constant Summary

DEFAULT_HEADERS = HTTP::Headers {"Content-Type" => "application/json", "Accept" => "application/json", "User-Agent" => "keycloak.cr/#{VERSION} Crystal/#{Crystal::VERSION}"}

Constructors

Instance methods inherited from module Keycloak::GroupClient

add_user_to_group(*, user_id : String, group_id : String) add_user_to_group, create_group(user : Representation::Group, *, parent : String | Nil = nil) create_group, delete_group(id : String) delete_group, get_group(id : String) : Representation::Group get_group, group_count : Int32 group_count, group_members(id : String, *, brief : Bool | Nil = nil, first : Int32 | Nil = nil, max : Int32 | Nil = nil) : Array(Representation::User) group_members, groups(*, brief : Bool | Nil = nil, exact : Bool | Nil = nil, first : Int32 | Nil = nil, max : Int32 | Nil = nil, q : String | Nil = nil, search : String | Nil = nil) : Array(Representation::Group) groups, remove_user_from_group(*, user_id : String, group_id : String) remove_user_from_group, user_group_count(id : String) : Int32 user_group_count

Instance methods inherited from module Keycloak::UserClient

create_user(user : Representation::User) create_user, delete_user(id : String) delete_user, get_user(id : String, klass = Representation::User) get_user, get_user_credentials(id : String) : Array(Representation::Credential) get_user_credentials, reset_password(id : String, cred : Representation::Credential) reset_password, send_verify_email(id : String, *, client_id : String | Nil = nil, redirect_uri : String | Nil = nil) send_verify_email, update_user(user : Representation::User) update_user, user_count(*, email : String | Nil = nil, email_verified : Bool | Nil = nil, enabled : Bool | Nil = nil, firstname : String | Nil = nil, lastname : String | Nil = nil, search : String | Nil = nil, username : String | Nil = nil) : Int32 user_count, user_groups(id : String, *, brief : Bool | Nil = nil, first : Int32 | Nil = nil, max : Int32 | Nil = nil, search : String | Nil = nil) : Array(Representation::Group) user_groups, user_sessions(id : String) : Representation::UserSession user_sessions, users(*, brief : Bool | Nil = nil, email : String | Nil = nil, email_verified : Bool | Nil = nil, enabled : Bool | Nil = nil, exact : Bool | Nil = nil, first : Int32 | Nil = nil, firstname : String | Nil = nil, idp_alias : String | Nil = nil, idp_user_id : String | Nil = nil, lastname : String | Nil = nil, max : Int32 | Nil = nil, q : String | Nil = nil, search : String | Nil = nil, username : String | Nil = nil, klass = Array(Representation::User)) users

Constructor Detail

def self.new(config_url : String, client_id : String, client_secret : String) #

Create a new client based on the given url, client and secret.

  • config_url the url usually of the keycloak config url, usually ends with ".well-known/openid-configuration"
  • client_id the id of the client to use
  • client_secret the secret to authenticate the client

[View source]
def self.new(client : OIDC::Client) #

Create a new client using an already existing OIDC client.


[View source]