User Attribute Protocol Mapper API
The UserAttributeProtocolMapperHandle class extends the ProtocolMapperHandle class and provides a specialized API for managing user attribute protocol mappers in Keycloak. These mappers map user attributes to token claims.
Class: UserAttributeProtocolMapperHandle
Constructor
constructor(core: KeycloakAdminClient, clientHandle: ClientHandle, mapperName: string)
- Parameters:
core: An instance ofKeycloakAdminClient.clientHandle: A handle to the client where the protocol mapper resides.mapperName: The name of the user attribute protocol mapper to manage.
Instance Methods
create(data: UserAttributeProtocolMapperInputData)
Creates a new user attribute protocol mapper.
public async create(data: UserAttributeProtocolMapperInputData)
- Parameters:
data: The data for the new user attribute protocol mapper.
- Throws: An error if the protocol mapper already exists.
update(data: UserAttributeProtocolMapperInputData)
Updates the user attribute protocol mapper's details.
public async update(data: UserAttributeProtocolMapperInputData)
- Parameters:
data: The updated data for the user attribute protocol mapper.
- Throws: An error if the protocol mapper does not exist.
ensure(data: UserAttributeProtocolMapperInputData)
Ensures the user attribute protocol mapper exists. If it does, updates it; otherwise, creates it.
public async ensure(data: UserAttributeProtocolMapperInputData)
- Parameters:
data: The data for the user attribute protocol mapper.
Types
UserAttributeProtocolMapperInputData
The input data type for creating or updating a user attribute protocol mapper.
export interface UserAttributeProtocolMapperInputData extends ProtocolMapperInputData {
userAttribute: string;
claimName: string;
}
This API provides a specialized interface for managing user attribute protocol mappers in Keycloak, ensuring they are configured with the appropriate defaults for mapping user attributes to token claims.