AuthApi#

class ansys.hps.client.auth.api.AuthApi(client)#

Provides a minimal wrapper around the Keycloak API to query user information.

Parameters:
clientClient

HPS client object.

Examples

Get users whose first name contains john.

>>> from ansys.hps.client import Client
>>> from ansys.hps.client.auth import AuthApi, User
>>> cl = Client(
...     url="https://127.0.0.1:8443/hps", username="repuser", password="repuser"
... )
>>> auth_api = AuthApi(cl)
>>> users = auth_api.get_users(firstName="john", exact=False)

Methods

AuthApi.get_user(id[, as_object])

Get the user representation for a given user ID.

AuthApi.get_user_groups(id)

Get the groups that the user belongs to.

AuthApi.get_user_groups_names(id)

Get the name of the groups that the user belongs to.

AuthApi.get_user_realm_roles(id)

Get the realm roles for the user.

AuthApi.get_user_realm_roles_names(id)

Get the name of the realm roles for the user.

AuthApi.get_users([as_objects])

Get users, filtered according to query parameters.

AuthApi.user_is_admin(id)

Determine if the user is a system administrator.

Attributes

AuthApi.realm_url

Realm URL.

AuthApi.url

API URL.