{"id":15091412,"url":"https://github.com/ccouzens/keycloak-openapi","last_synced_at":"2025-04-09T12:08:33.833Z","repository":{"id":37029981,"uuid":"185045075","full_name":"ccouzens/keycloak-openapi","owner":"ccouzens","description":"OpenAPI definitions for Keycloak's Admin API","archived":false,"fork":false,"pushed_at":"2024-02-29T20:01:10.000Z","size":820,"stargazers_count":173,"open_issues_count":6,"forks_count":66,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-02T10:13:47.287Z","etag":null,"topics":["keycloak","openapi-definitions","openapi-specification","openapi3"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ccouzens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-05-05T14:54:51.000Z","updated_at":"2025-02-07T10:27:42.000Z","dependencies_parsed_at":"2024-01-12T20:03:49.803Z","dependency_job_id":null,"html_url":"https://github.com/ccouzens/keycloak-openapi","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccouzens%2Fkeycloak-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccouzens%2Fkeycloak-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccouzens%2Fkeycloak-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccouzens%2Fkeycloak-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccouzens","download_url":"https://codeload.github.com/ccouzens/keycloak-openapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036067,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keycloak","openapi-definitions","openapi-specification","openapi3"],"created_at":"2024-09-25T10:40:59.841Z","updated_at":"2025-04-09T12:08:33.799Z","avatar_url":"https://github.com/ccouzens.png","language":"Rust","readme":"# Keycloak-Admin-OpenAPI-Definition\n\n[OpenAPI definitions](https://github.com/OAI/OpenAPI-Specification) for\n[Keycloak](https://www.keycloak.org/)'s Admin API.\n\nThese can be used to generate libraries for interacting with Keycloak from any\nmainstream programming langauge.\n\nOpenAPI definitions are sometimes known by their previous name of Swagger\nspecifications.\n\n[Keycloak 22.0.0 Admin API](./keycloak/22.0.0.json)\n\n[Keycloak 13.0 Admin API with patches](./keycloak/13.0-patched.json)\n\n[Keycloak 12.0 Admin API with patches](./keycloak/12.0-patched.json)\n\n[Other versions](./keycloak/)\n\n## Alternatives\n\nDAHAG Rechtsservices AG\n[provide OpenAPI definitions](https://github.com/dahag-ag/keycloak-openapi) for\nrecent versions of Keycloak which are more complete than what's here.\n\n## Account API\n\nKeycloak has an undocumented [Account API](https://github.com/keycloak/keycloak/blob/main/services/src/main/java/org/keycloak/services/resources/account/AccountRestService.java) that is used by the internal account console to display and update user information. This can be used for building a custom account console, or building account information and editing into an application. [@xgp](https://github.com/xgp) has created a [Gist of OpenAPI definitions of the Account API](https://gist.github.com/xgp/2d77cbebc6164160faae6aa77d127a57).\n\n## General Usage\n\nTypically to use Keycloak's admin Rest API, you first get a token from a realm.\nThis is done using the OAuth2 protocol.\n\n```bash\nbearer_token=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \\\n     --data-urlencode 'username=admin-user' \\\n     --data-urlencode 'password=admin-password' \\\n     --data-urlencode 'grant_type=password' \\\n     --data-urlencode 'client_id=admin-cli' \\\n      | jq -r '.access_token')\n```\n\nThe realm used for the token is not necessarily the realm used in the API.\n\nThe endpoints in this specification can then be used with a base url of the form\n`http://localhost:8080/auth/admin/realms` and the above bearer token.\n\nPlease see the [example app](example_app/src/index.ts).\n\n## Help wanted\n\nThe definitions are computer generated, but\n[could do with a human's input](https://github.com/ccouzens/keycloak-openapi/issues/10).\n\n[Please provide additional example apps](https://github.com/ccouzens/keycloak-openapi/issues/14).\n\n## Adding new versions\n\nTo add a new version of Keycloak perform these steps:\n\n1. Modify the [Makefile](./Makefile) with the\n   [new version](https://github.com/ccouzens/keycloak-openapi/commit/6f717533b13cd07bae3c4aa1f55907fb40338540#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52).\n2. Verify you have installed the [requirements](#requirements).\n3. Run the command `make`. It will automatically:\n   1. download the documentation in HTML format\n   2. compile the [transformer](#keycloak-openapi-transformer)\n   3. create the JSON definition\n   4. create the YML definition\n4. Commit your changes and open a pull request.\n\n## Notable Changes\n\n2021 Early - Renamed master branch to main. Anyone fetching the schema directly\nfrom the branch should update their reference.\n\n2020 May - Added tags to operations. Users of OpenAPI Generator generated\nclients will need to swap from using the `DefaultApi` class to multiple classes\nsuch as `UsersApi` or `ClientsApi`.\n\n## Example App\n\n[This example](./example_app/) uses\n[openapi-generator](https://github.com/OpenAPITools/openapi-generator) to build\nan API-client. The app in the example is very simple and only fetches a list of\nKeycloak-clients.\n\n```bash\n# Create a keycloak instance to run against\ndocker container run --rm -e KEYCLOAK_USER=admin-user -e KEYCLOAK_PASSWORD=admin-password -p 8080:8080 docker.io/jboss/keycloak:13.0.0\n# Open http://localhost:8080/ and wait for keycloak to start up\n\n# In a second terminal run\ncd example_app\nnpm install\nnpm run generate-client\nnpm run compile\nnode dist/index.js\n# prints out\n# The default clients:\n#   account\n#   account-console\n#   admin-cli\n#   broker\n#   master-realm\n#   security-admin-console\n```\n\nIn general, clients can be generated by running a command similar to:\n\n```bash\nopenapi-generator generate -i 'https://github.com/ccouzens/keycloak-openapi/raw/main/keycloak/20.0.3.json' -g 'typescript-axios' -o 'src/keycloak-client'\n```\n\nor using docker, if you can't install `openapi-generator`:\n\n```bash\ndocker run --rm --user $(id -u):$(id -g) -v $PWD:/local openapitools/openapi-generator-cli generate -i 'https://github.com/ccouzens/keycloak-openapi/raw/main/keycloak/20.0.3.json' -g typescript-axios -o /local/src/keycloak-client\n```\n## Keycloak OpenAPI Transformer\n\nAll the OpenAPI definitions are generated from the published HTML documentation.\nThis tool transforms the HTML documentation into OpenAPI definitions.\n\nHTML of the documentation is inputted through `stdin` and the JSON of the\ndefinition is outputted through `stdout`.\n\n## Requirements\n\nBuilding Red Hat Single Sign-On definitions or rebuilding Keycloak's definitions\nrequires:\n\n- `make`\n- [`Rust`](https://www.rust-lang.org/tools/install)\n- [`yq`](https://github.com/mikefarah/yq/)\n\nBuilding the transformer requires\n[`Rust`](https://www.rust-lang.org/tools/install).\n\nBuilding the example app requires `Node` and `Java`.\n\nRunning the keycloak instance that pairs with the example app requires `Docker`.\n\n## Licensing\n\nThe OpenAPI definitions are [Apache 2.0 licensed](./keycloak/LICENSE.txt).\n\nThe transformer is [MIT licensed](keycloak-openapi-transformer/LICENSE).\n\nThe example app has a [CC0 waiver](example_app/WAIVER) (has had its copyright\nwaived).\n","funding_links":[],"categories":["Tools"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccouzens%2Fkeycloak-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccouzens%2Fkeycloak-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccouzens%2Fkeycloak-openapi/lists"}