<<

NAME

ProductOpener::Keycloak - Perl module for Keycloak user management

DESCRIPTION

This Perl module provides access to Keycloak specific functionality that goes beyond that of a standard OIDC authentication service.

This includes user management APIs and the user security settings forms.

get_or_refresh_token()

Retrieves or refreshes the access token for managing users with Keycloak.

If the token is not defined, it retrieves a new token using client credentials. If the token is defined but has expired, it refreshes the token. The token is stored in the object and its expiration time is updated.

Arguments

None

Return values

Returns the access token. Throws an exception if the token cannot be obtained.

create_or_update_user ($user_ref, $password)

Create use on keycloak side.

This is needed as we register new users via an old, undocumented API function. We create the user properties file locally before, and we create the user in keycloak in this sub.

Arguments

User info hashmap reference $user_ref

String $password

find_user_by_username ($username)

Try to find a user in Keycloak by their username.

Arguments

User's username $username

Return Value

A hashmap reference with user information from Keycloak.

find_user_by_email ($mail)

Try to find a user in Keycloak by their mail address.

Arguments

User's mail address $mail

Return Value

A hashmap reference with user information from Keycloak.

get_account_link()

Gets the link to the account service on Keycloak.

Arguments

Canonical URL of the current site string $url

Return values

Returns the URL.

_find_user_by_single_attribute_exact ($name, $value)

Try to find a user in Keycloak by a single attribute key/value combo.

This should only be used with unique attributes like email or username.

Arguments

Name of the attribute $name

Value of the attribute $value

Return Value

A hashmap reference with user information from Keycloak.

<<