<!--- Top of README Badges (automated) --->
[![PyPI](https://img.shields.io/pypi/v/wipac-keycloak-rest-services)](https://pypi.org/project/wipac-keycloak-rest-services/) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/WIPACrepo/keycloak-rest-services?include_prereleases)](https://github.com/WIPACrepo/keycloak-rest-services/) [![PyPI - License](https://img.shields.io/pypi/l/wipac-keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/blob/master/LICENSE) [![Lines of code](https://img.shields.io/tokei/lines/github/WIPACrepo/keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/) [![GitHub issues](https://img.shields.io/github/issues/WIPACrepo/keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aopen) [![GitHub pull requests](https://img.shields.io/github/issues-pr/WIPACrepo/keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Aopen)
<!--- End of README Badges (automated) --->
# keycloak-rest-services
Services surrounding Keycloak, that use the REST API to read/update state.
## Running Tests
The tests run automatically in CircleCI, but for those that want to run them
locally, there is a way.
First, build and load the local python environment:
./setupenv.sh
. env/bin/activate
Then, start instances of Keycloak, LDAP, and RabbitMQ in other terminals:
./resources/start-keycloak.sh
./resources/start-ldap.sh
./resources/start-rabbitmq.sh
Note that version of Keycloak server used for testing is set in `resources/keycloak-image/Dockerfile`.
Keycloak may take a minute to start. If it does not, check your network settings,
as it does not play well with VPNs and other more exotic network situations.
Finally, run the tests:
source ./resources/pytest-env.sh
pytest
### Getting Test Coverage
If you want a coverage report, instead of running pytest directly, run it
under the coverage tool:
keycloak_url=http://localhost:8080 username=admin password=admin coverage run -m pytest
coverage html --include='krs*'
## Manually Running Scripts
It is possible to manually run all of the basic operations for controlling users
and groups.
1. Bootstrap Keycloak
If you do not already have a Keycloak instance, start a test instance as shown above.
Then, run the bootstrap script to create a realm and the REST service account:
```bash
keycloak_url=http://localhost:8080 username=admin password=admin realm=test python3 -m krs.bootstrap
```
Save the `client_secret` that gets printed, as you will need this.
2. User and group actions
Now you can actually run the scripts, which take the format:
```bash
keycloak_url=http://localhost:8080 client_id=rest-access client_secret=<SECRET> realm=test python -m krs.<SCRIPT> <ARGS>
```
As an example, to list all groups:
```bash
keycloak_url=http://localhost:8080 client_id=rest-access client_secret=<SECRET> realm=test python -m krs.groups list
```
Raw data
{
"_id": null,
"home_page": "https://github.com/WIPACrepo/keycloak-rest-services",
"name": "wipac-keycloak-rest-services",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.9",
"maintainer_email": null,
"keywords": "keycloak, rest, tools, utilities",
"author": "WIPAC Developers",
"author_email": "developers@icecube.wisc.edu",
"download_url": "https://files.pythonhosted.org/packages/52/83/58027a6654bd300586a86278fa8df69b6eaa7f103ca444706879ad427eda/wipac-keycloak-rest-services-1.4.113.tar.gz",
"platform": null,
"description": "<!--- Top of README Badges (automated) --->\n[![PyPI](https://img.shields.io/pypi/v/wipac-keycloak-rest-services)](https://pypi.org/project/wipac-keycloak-rest-services/) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/WIPACrepo/keycloak-rest-services?include_prereleases)](https://github.com/WIPACrepo/keycloak-rest-services/) [![PyPI - License](https://img.shields.io/pypi/l/wipac-keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/blob/master/LICENSE) [![Lines of code](https://img.shields.io/tokei/lines/github/WIPACrepo/keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/) [![GitHub issues](https://img.shields.io/github/issues/WIPACrepo/keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aopen) [![GitHub pull requests](https://img.shields.io/github/issues-pr/WIPACrepo/keycloak-rest-services)](https://github.com/WIPACrepo/keycloak-rest-services/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Aopen) \n<!--- End of README Badges (automated) --->\n# keycloak-rest-services\nServices surrounding Keycloak, that use the REST API to read/update state.\n\n## Running Tests\n\nThe tests run automatically in CircleCI, but for those that want to run them\nlocally, there is a way.\n\nFirst, build and load the local python environment:\n\n ./setupenv.sh\n . env/bin/activate\n\nThen, start instances of Keycloak, LDAP, and RabbitMQ in other terminals:\n\n ./resources/start-keycloak.sh\n ./resources/start-ldap.sh\n ./resources/start-rabbitmq.sh\n\nNote that version of Keycloak server used for testing is set in `resources/keycloak-image/Dockerfile`.\n\nKeycloak may take a minute to start. If it does not, check your network settings,\nas it does not play well with VPNs and other more exotic network situations.\n\nFinally, run the tests:\n\n source ./resources/pytest-env.sh\n pytest\n\n### Getting Test Coverage\n\nIf you want a coverage report, instead of running pytest directly, run it\nunder the coverage tool:\n\n keycloak_url=http://localhost:8080 username=admin password=admin coverage run -m pytest\n coverage html --include='krs*'\n\n## Manually Running Scripts\n\nIt is possible to manually run all of the basic operations for controlling users\nand groups.\n\n1. Bootstrap Keycloak\n\n If you do not already have a Keycloak instance, start a test instance as shown above.\n Then, run the bootstrap script to create a realm and the REST service account:\n\n ```bash\n keycloak_url=http://localhost:8080 username=admin password=admin realm=test python3 -m krs.bootstrap\n ```\n\n Save the `client_secret` that gets printed, as you will need this.\n\n2. User and group actions\n\n Now you can actually run the scripts, which take the format:\n\n ```bash\n keycloak_url=http://localhost:8080 client_id=rest-access client_secret=<SECRET> realm=test python -m krs.<SCRIPT> <ARGS>\n ```\n\n As an example, to list all groups:\n\n ```bash\n keycloak_url=http://localhost:8080 client_id=rest-access client_secret=<SECRET> realm=test python -m krs.groups list\n ```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Services surrounding KeyCloak, that use the REST API to read/update state",
"version": "1.4.113",
"project_urls": {
"Download": "https://pypi.org/project/wipac-keycloak-rest-services/",
"Homepage": "https://github.com/WIPACrepo/keycloak-rest-services",
"Source": "https://github.com/WIPACrepo/keycloak-rest-services",
"Tracker": "https://github.com/WIPACrepo/keycloak-rest-services/issues"
},
"split_keywords": [
"keycloak",
" rest",
" tools",
" utilities"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e3e0da91eec9f8d2cdb651ffa3ce5f0118e5f57d1afe9934e85d6be6c0d7e82",
"md5": "1f959f012f9c2efff7b75d3281e048cd",
"sha256": "e0883e0bc8e5e8085fa63eabb98a51052a6082a40e4912126dba392adcacf058"
},
"downloads": -1,
"filename": "wipac_keycloak_rest_services-1.4.113-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1f959f012f9c2efff7b75d3281e048cd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.9",
"size": 32154,
"upload_time": "2024-11-21T21:31:58",
"upload_time_iso_8601": "2024-11-21T21:31:58.276261Z",
"url": "https://files.pythonhosted.org/packages/1e/3e/0da91eec9f8d2cdb651ffa3ce5f0118e5f57d1afe9934e85d6be6c0d7e82/wipac_keycloak_rest_services-1.4.113-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "528358027a6654bd300586a86278fa8df69b6eaa7f103ca444706879ad427eda",
"md5": "4876f70be4c8e66cc3f8996e5f90b93c",
"sha256": "4a89d4c092fc00be23f22bd105e14b88cebc2d509e1fe7452ec1eee730e58ced"
},
"downloads": -1,
"filename": "wipac-keycloak-rest-services-1.4.113.tar.gz",
"has_sig": false,
"md5_digest": "4876f70be4c8e66cc3f8996e5f90b93c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.9",
"size": 28527,
"upload_time": "2024-11-21T21:31:59",
"upload_time_iso_8601": "2024-11-21T21:31:59.949690Z",
"url": "https://files.pythonhosted.org/packages/52/83/58027a6654bd300586a86278fa8df69b6eaa7f103ca444706879ad427eda/wipac-keycloak-rest-services-1.4.113.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-21 21:31:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "WIPACrepo",
"github_project": "keycloak-rest-services",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "wipac-keycloak-rest-services"
}