<!--- 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
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": "",
"docs_url": null,
"requires_python": "<3.13,>=3.9",
"maintainer_email": "",
"keywords": "keycloak,rest,tools,utilities",
"author": "WIPAC Developers",
"author_email": "developers@icecube.wisc.edu",
"download_url": "https://files.pythonhosted.org/packages/09/f9/a59b54549a1d09b3ec348aeaa99636db2bd073e0ca6ec138de4120c5d65a/wipac-keycloak-rest-services-1.4.66.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\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.66",
"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": "2e8c49b3f61778eda7eb9f99184eba5d9d7c8a976d0d57c08ee6ca40e5c48a22",
"md5": "0520b7205a8e838bcbf6e847217fc0ed",
"sha256": "01201a58e37d03da3696e269f93b4d599ba96a2e473fe5d5efe0c10309468d51"
},
"downloads": -1,
"filename": "wipac_keycloak_rest_services-1.4.66-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0520b7205a8e838bcbf6e847217fc0ed",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.9",
"size": 28920,
"upload_time": "2024-03-19T15:31:48",
"upload_time_iso_8601": "2024-03-19T15:31:48.775818Z",
"url": "https://files.pythonhosted.org/packages/2e/8c/49b3f61778eda7eb9f99184eba5d9d7c8a976d0d57c08ee6ca40e5c48a22/wipac_keycloak_rest_services-1.4.66-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "09f9a59b54549a1d09b3ec348aeaa99636db2bd073e0ca6ec138de4120c5d65a",
"md5": "b2b8476bdd0b822284108055ab52c05e",
"sha256": "a8887c4deef6ca57cdab543a23cc47adeb9e5207c8bf5579aa554990da86eca3"
},
"downloads": -1,
"filename": "wipac-keycloak-rest-services-1.4.66.tar.gz",
"has_sig": false,
"md5_digest": "b2b8476bdd0b822284108055ab52c05e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.9",
"size": 25542,
"upload_time": "2024-03-19T15:31:50",
"upload_time_iso_8601": "2024-03-19T15:31:50.812732Z",
"url": "https://files.pythonhosted.org/packages/09/f9/a59b54549a1d09b3ec348aeaa99636db2bd073e0ca6ec138de4120c5d65a/wipac-keycloak-rest-services-1.4.66.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-19 15:31:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "WIPACrepo",
"github_project": "keycloak-rest-services",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aio-pika",
"specs": [
[
"==",
"9.3.0"
]
]
},
{
"name": "aiormq",
"specs": [
[
"==",
"6.7.7"
]
]
},
{
"name": "cachetools",
"specs": [
[
"==",
"5.3.1"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2023.7.22"
]
]
},
{
"name": "cffi",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.0"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"41.0.4"
]
]
},
{
"name": "dnspython",
"specs": [
[
"==",
"2.4.2"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.4"
]
]
},
{
"name": "ldap3",
"specs": [
[
"==",
"2.9.1"
]
]
},
{
"name": "motor",
"specs": [
[
"==",
"3.3.1"
]
]
},
{
"name": "multidict",
"specs": [
[
"==",
"6.0.4"
]
]
},
{
"name": "pamqp",
"specs": [
[
"==",
"3.2.1"
]
]
},
{
"name": "pyasn1",
"specs": [
[
"==",
"0.5.0"
]
]
},
{
"name": "pycparser",
"specs": [
[
"==",
"2.21"
]
]
},
{
"name": "pyjwt",
"specs": [
[
"==",
"2.8.0"
]
]
},
{
"name": "pymongo",
"specs": [
[
"==",
"4.5.0"
]
]
},
{
"name": "pypng",
"specs": [
[
"==",
"0.20220715.0"
]
]
},
{
"name": "qrcode",
"specs": [
[
"==",
"7.4.2"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
},
{
"name": "requests-futures",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "tornado",
"specs": [
[
"==",
"6.3.3"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"==",
"4.8.0"
]
]
},
{
"name": "unidecode",
"specs": [
[
"==",
"1.3.7"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.0.6"
]
]
},
{
"name": "wipac-dev-tools",
"specs": [
[
"==",
"1.6.16"
]
]
},
{
"name": "wipac-rest-tools",
"specs": [
[
"==",
"1.6.0"
]
]
},
{
"name": "yarl",
"specs": [
[
"==",
"1.9.2"
]
]
}
],
"lcname": "wipac-keycloak-rest-services"
}