wipac-keycloak-rest-services


Namewipac-keycloak-rest-services JSON
Version 1.4.88 PyPI version JSON
download
home_pagehttps://github.com/WIPACrepo/keycloak-rest-services
SummaryServices surrounding KeyCloak, that use the REST API to read/update state
upload_time2024-05-06 20:41:00
maintainerNone
docs_urlNone
authorWIPAC Developers
requires_python<3.13,>=3.9
licenseMIT
keywords keycloak rest tools utilities
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--- 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.13,>=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/b1/f2/dd1e2e8762a2ea0a2e7032dac0a73c3a92d139368e4fe1eebe323a5bad9f/wipac-keycloak-rest-services-1.4.88.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.88",
    "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": "2e132b79907ff7df08821a23a200cd548ee73b17cfaefcb7079677061bd5cd97",
                "md5": "a71f9f5ac3fcd54c10c7d24f89820354",
                "sha256": "aa1859ce5ba5e91a56bb18ae43728f6403d2c92faa08537299ee83692a096f76"
            },
            "downloads": -1,
            "filename": "wipac_keycloak_rest_services-1.4.88-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a71f9f5ac3fcd54c10c7d24f89820354",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 30883,
            "upload_time": "2024-05-06T20:40:57",
            "upload_time_iso_8601": "2024-05-06T20:40:57.575474Z",
            "url": "https://files.pythonhosted.org/packages/2e/13/2b79907ff7df08821a23a200cd548ee73b17cfaefcb7079677061bd5cd97/wipac_keycloak_rest_services-1.4.88-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1f2dd1e2e8762a2ea0a2e7032dac0a73c3a92d139368e4fe1eebe323a5bad9f",
                "md5": "7ac8b04049d11d9b801d4c809cba23ec",
                "sha256": "039ad8a1dada04cbb5a3ddbe7b8f3e07544297a132c1a6b8b19c2bc7422b76b9"
            },
            "downloads": -1,
            "filename": "wipac-keycloak-rest-services-1.4.88.tar.gz",
            "has_sig": false,
            "md5_digest": "7ac8b04049d11d9b801d4c809cba23ec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 27302,
            "upload_time": "2024-05-06T20:41:00",
            "upload_time_iso_8601": "2024-05-06T20:41:00.147025Z",
            "url": "https://files.pythonhosted.org/packages/b1/f2/dd1e2e8762a2ea0a2e7032dac0a73c3a92d139368e4fe1eebe323a5bad9f/wipac-keycloak-rest-services-1.4.88.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-06 20:41:00",
    "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"
}
        
Elapsed time: 0.27550s