Client scopes¶
https://www.keycloak.org/docs-api/26.0.0/rest-api/index.html#_client_scopes
- class keycloak_admin_aio._resources.client_scopes.ClientScopes¶
Provides the Keycloak client scopes resource.
from keycloak_admin_aio import KeycloakAdmin, ClientScopeRepresentation kc: KeycloakAdmin # must be instantiated
- get_url()¶
Get the resource’s url.
- Return type:
str
- async create(client_scope_representation)¶
Create a client scope.
client_scope_representation = ClientScopeRepresentation(name="client-scope-name") client_scope_id: str = await kc.client_scopes.create(client_scope_representation)
- Parameters:
client_scope_representation (ClientScopeRepresentation)
- Return type:
str
- async get()¶
Get client scopes.
client_scopes: list[ClientScopeRepresentation] = await kc.client_scopes.get()
Client scopes by id¶
- class keycloak_admin_aio._resources.client_scopes.by_id.ClientScopesById¶
Client scopes by id.
from keycloak_admin_aio import KeycloakAdmin, ClientScopeRepresentation kc: KeycloakAdmin # must be instantiated client_scope_id: str # uuid
- get_url()¶
Get the resource’s url.
- Return type:
str
- async get()¶
Get a client scope by id.
client_scope: ClientScopeRepresentation = await kc.client_scopes.by_id(client_scope_id).get()
- Return type:
- async update(client_scope_representation)¶
Update a client scope by id.
client_scope_representation = ClientScopeRepresentation(name="client-scope-name") await kc.client_scopes.by_id(client_scope_id).update(client_scope_representation)
- Parameters:
client_scope_representation (ClientScopeRepresentation)
- async delete()¶
Delete a client scope by id.
await kc.client_scopes.by_id(client_scope_id).delete()
Scope mappings for a client scope by id¶
- class keycloak_admin_aio._resources.client_scopes.by_id.scope_mappings.ClientScopesScopeMappings¶
Scopes mappings for client scopes by id.
from keycloak_admin_aio import KeycloakAdmin, MappingsRepresentation kc: KeycloakAdmin # must be instantiated client_scope_id: str # uuid
- get_url()¶
Get the resource’s url.
- Return type:
str
- async get()¶
Get scope mappings for a client scope by id.
client_scope_resource = kc.client_scopes.by_id(client_scope_id) mappings: MappingsRepresentation = await client_scope_resource.scope_mappings.get()
- Return type:
Realm scope mappings for a client scope by id¶
- class keycloak_admin_aio._resources.client_scopes.by_id.scope_mappings.realm.ClientScopesScopeMappingsRealm¶
Realm scope mappings for a client scope by id.
from keycloak_admin_aio import KeycloakAdmin, RoleRepresentation kc: KeycloakAdmin # must be instantiated client_scope_id: str # uuid
- get_url()¶
Get the resource’s url.
- Return type:
str
- async create(role_representations)¶
Add roles to the realm scope mappings of a client scope by id.
role_representations: list[RoleRepresentation] = [] # needs to be populated await kc.client_scopes.by_id(client_scope_id).scope_mappings.realm.create(roles)
- Parameters:
role_representations (list[RoleRepresentation])
- async get()¶
Get realm scope mappings for a client scope by id.
client_scope_resource = kc.client_scopes.by_id(client_scope_id) roles: list[RoleRepresentation] = await client_scope_resource.scope_mappings.realm.get()
- Return type:
list[RoleRepresentation]
- async delete(role_representations)¶
Remove roles from realm scope mappings for a client scope by id.
role_representations: list[RoleRepresentation] = [] # needs to be populated client_scope_resource = kc.client_scopes.by_id(client_scope_id) await client_scope_resource.scope_mappings.realm.delete(role_representations)
- Parameters:
role_representations (list[RoleRepresentation])