Keycloak plugin to enable API Keys for user authentication.
This extension extends Keycloak Server providing additional REST endpoints to create and manage API Keys.
mvn clean package
- Build using
mvn clean package
- Run
docker-compose up
- URL: http://localhost/realms/{realm_name}/apikey/api_key
- Method:
GET
- Authorization:
Bearer token
of the owner of the apiKey. - Description: Retrieves a list of API Keys by user.
- Query Params:
user_id
(string) Required - The ID of the user.query
(string) optional - The ID of an API Key to filter.limit
(string) optional - Allows to limit the number of API Keys to retrieve. Default 20.offset
(string) optional - Allows to omit a specified number of API Keys before the beginning of the result set. Default 0.sort
(string) optional - Sort API Keys by a specific field. Values: expirydate, issuedate, isrevoked, description. Default name.sortOrder
(string) optional - Ascending or descending order. Values: ASC or DESC. Default DESC.
- URL: http://localhost/realms/{realm_name}/apikey/api_key
- Method:
POST
- Authorization:
Bearer token
of the owner of the apiKey or an Admin user. - Description: Creates a new API Key.
- Query Params:
user_id
(string) - The ID of the user.description
(string) - Description of the API Key.scopes
(string) 1 or more - A permission of this API Key format {policy}.{access_level}.
- URL: http://localhost/realms/{realm_name}/apikey/check_api_key
- Method:
POST
- Header: 'Content-Type: multipart/form-data'
- Authorization:
Bearer token
of the owner of the apiKey orBasic auth
of a client. - Description: Checks the API Key.
- Body (form-data):
apiKey
(string) - The ID of an API Key
- URL: http://localhost/realms/{realm_name}/apikey/api_key
- Method:
DELETE
- Authorization:
Bearer token
of the owner of the apiKey or an Admin user. - Description: Revoke a specific API Key.
- Query Params:
apiKey
(string) - The ID of an API Key.