<!--- 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/a3/6c/a0170764e4e7b8f7f0e432116803abcc9c914cc06478197d5627f553b228/wipac-keycloak-rest-services-1.4.117.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.117",
"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": "81420ca40fb4f193afb503fd6281dd415ec7bb8fb4ff6e76f774161e602b1532",
"md5": "6a14a363448230b5d3e2a95785a6911f",
"sha256": "a7a771aa1dd38574665bae780a80b85d5d9b285e2c2ffa3c1b220f2136199d6c"
},
"downloads": -1,
"filename": "wipac_keycloak_rest_services-1.4.117-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6a14a363448230b5d3e2a95785a6911f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.9",
"size": 31526,
"upload_time": "2024-12-06T18:56:37",
"upload_time_iso_8601": "2024-12-06T18:56:37.633667Z",
"url": "https://files.pythonhosted.org/packages/81/42/0ca40fb4f193afb503fd6281dd415ec7bb8fb4ff6e76f774161e602b1532/wipac_keycloak_rest_services-1.4.117-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a36ca0170764e4e7b8f7f0e432116803abcc9c914cc06478197d5627f553b228",
"md5": "e61ff9653dbbc7f3b76c663fd23f7ca8",
"sha256": "9cbaa9ef3f01599aa6c7987a3c4ae623aeb2bae80d8292015f8184a7ad8804b2"
},
"downloads": -1,
"filename": "wipac-keycloak-rest-services-1.4.117.tar.gz",
"has_sig": false,
"md5_digest": "e61ff9653dbbc7f3b76c663fd23f7ca8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.9",
"size": 27876,
"upload_time": "2024-12-06T18:56:39",
"upload_time_iso_8601": "2024-12-06T18:56:39.367428Z",
"url": "https://files.pythonhosted.org/packages/a3/6c/a0170764e4e7b8f7f0e432116803abcc9c914cc06478197d5627f553b228/wipac-keycloak-rest-services-1.4.117.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 18:56:39",
"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"
}