directory-sso-api-client


Namedirectory-sso-api-client JSON
Version 7.2.6 PyPI version JSON
download
home_pagehttps://github.com/uktrade/directory-sso-api-client
SummaryPython API client for Export Directory.
upload_time2024-01-19 21:16:17
maintainer
docs_urlNone
authorDepartment for International Trade
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # directory-sso-api-client

[![code-climate-image]][code-climate]
[![circle-ci-image]][circle-ci]
[![codecov-image]][codecov]
[![pypi-image]][pypi]
[![semver-image]][semver]

**[Directory SSO API client](https://great.gov.uk/)**

---

## Installation

```sh
    $ pip install directory-sso-api-client
```

The api client expects the following settings:

| Setting                                  | Notes                                                       |
| ---------------------------------------- | ----------------------------------------------------------- |
| DIRECTORY_SSO_API_CLIENT_BASE_URL        |                                                             |
| DIRECTORY_SSO_API_CLIENT_API_KEY         | Unique to client. Retrieved during the on-boarding process. |
| DIRECTORY_SSO_API_CLIENT_SENDER_ID       | Unique to client. Retrieved during the on-boarding process. |
| DIRECTORY_SSO_API_CLIENT_DEFAULT_TIMEOUT |                                                             |

Once that is done the API client can be used:

```py
from directory_sso_api_client.client import sso_api_client
```

## Authentication backend

Add the following to your settings

```
AUTHENTICATION_BACKENDS = ['directory_sso_api_client.backends.SSOUserBackend']

AUTH_USER_MODEL='directory_sso_api_client.SSOUser',

MIDDLEWARE_CLASSES = [
    ...
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    ...
```

That will result in the user being authenticate via their sso session cookie and then attached to `request.user`.

## Development

```shell
$ git clone https://github.com/uktrade/directory-sso-api-client
$ cd directory-sso-api-client
$ [create virtual environment and activate]
$ pip install -r requirements_test.txt
```

## Publish to PyPI

The package should be published to PyPI on merge to master. If you need to do it locally then get the credentials from rattic and add the environment variables to your host machine:

| Setting                     |
| --------------------------- |
| DIRECTORY_PYPI_USERNAME     |
| DIRECTORY_PYPI_PASSWORD     |

Then run the following command:
```sh
    make publish
```


[code-climate-image]: https://codeclimate.com/github/uktrade/directory-sso-api-client/badges/issue_count.svg
[code-climate]: https://codeclimate.com/github/uktrade/directory-sso-api-client

[circle-ci-image]: https://circleci.com/gh/uktrade/directory-sso-api-client/tree/master.svg?style=svg
[circle-ci]: https://circleci.com/gh/uktrade/directory-sso-api-client/tree/master

[codecov-image]: https://codecov.io/gh/uktrade/directory-sso-api-client/branch/master/graph/badge.svg
[codecov]: https://codecov.io/gh/uktrade/directory-sso-api-client

[pypi-image]: https://badge.fury.io/py/directory-sso-api-client.svg
[pypi]: https://badge.fury.io/py/directory-sso-api-client

[semver-image]: https://img.shields.io/badge/Versioning%20strategy-SemVer-5FBB1C.svg
[semver]: https://semver.org



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/uktrade/directory-sso-api-client",
    "name": "directory-sso-api-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Department for International Trade",
    "author_email": "",
    "download_url": "",
    "platform": null,
    "description": "# directory-sso-api-client\n\n[![code-climate-image]][code-climate]\n[![circle-ci-image]][circle-ci]\n[![codecov-image]][codecov]\n[![pypi-image]][pypi]\n[![semver-image]][semver]\n\n**[Directory SSO API client](https://great.gov.uk/)**\n\n---\n\n## Installation\n\n```sh\n    $ pip install directory-sso-api-client\n```\n\nThe api client expects the following settings:\n\n| Setting                                  | Notes                                                       |\n| ---------------------------------------- | ----------------------------------------------------------- |\n| DIRECTORY_SSO_API_CLIENT_BASE_URL        |                                                             |\n| DIRECTORY_SSO_API_CLIENT_API_KEY         | Unique to client. Retrieved during the on-boarding process. |\n| DIRECTORY_SSO_API_CLIENT_SENDER_ID       | Unique to client. Retrieved during the on-boarding process. |\n| DIRECTORY_SSO_API_CLIENT_DEFAULT_TIMEOUT |                                                             |\n\nOnce that is done the API client can be used:\n\n```py\nfrom directory_sso_api_client.client import sso_api_client\n```\n\n## Authentication backend\n\nAdd the following to your settings\n\n```\nAUTHENTICATION_BACKENDS = ['directory_sso_api_client.backends.SSOUserBackend']\n\nAUTH_USER_MODEL='directory_sso_api_client.SSOUser',\n\nMIDDLEWARE_CLASSES = [\n    ...\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    ...\n```\n\nThat will result in the user being authenticate via their sso session cookie and then attached to `request.user`.\n\n## Development\n\n```shell\n$ git clone https://github.com/uktrade/directory-sso-api-client\n$ cd directory-sso-api-client\n$ [create virtual environment and activate]\n$ pip install -r requirements_test.txt\n```\n\n## Publish to PyPI\n\nThe package should be published to PyPI on merge to master. If you need to do it locally then get the credentials from rattic and add the environment variables to your host machine:\n\n| Setting                     |\n| --------------------------- |\n| DIRECTORY_PYPI_USERNAME     |\n| DIRECTORY_PYPI_PASSWORD     |\n\nThen run the following command:\n```sh\n    make publish\n```\n\n\n[code-climate-image]: https://codeclimate.com/github/uktrade/directory-sso-api-client/badges/issue_count.svg\n[code-climate]: https://codeclimate.com/github/uktrade/directory-sso-api-client\n\n[circle-ci-image]: https://circleci.com/gh/uktrade/directory-sso-api-client/tree/master.svg?style=svg\n[circle-ci]: https://circleci.com/gh/uktrade/directory-sso-api-client/tree/master\n\n[codecov-image]: https://codecov.io/gh/uktrade/directory-sso-api-client/branch/master/graph/badge.svg\n[codecov]: https://codecov.io/gh/uktrade/directory-sso-api-client\n\n[pypi-image]: https://badge.fury.io/py/directory-sso-api-client.svg\n[pypi]: https://badge.fury.io/py/directory-sso-api-client\n\n[semver-image]: https://img.shields.io/badge/Versioning%20strategy-SemVer-5FBB1C.svg\n[semver]: https://semver.org\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python API client for Export Directory.",
    "version": "7.2.6",
    "project_urls": {
        "Homepage": "https://github.com/uktrade/directory-sso-api-client"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "537fbfb4797a7768f33e29728ab396a2a864c70dd8ff0535860383e1551f7afa",
                "md5": "88a625c66d242a5b0c506a428897c426",
                "sha256": "05829d5f879d1b31ee5d340e1ba500d606d0e244639e6584d3e6dc9b82aa08d6"
            },
            "downloads": -1,
            "filename": "directory_sso_api_client-7.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "88a625c66d242a5b0c506a428897c426",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8124,
            "upload_time": "2024-01-19T21:16:17",
            "upload_time_iso_8601": "2024-01-19T21:16:17.628191Z",
            "url": "https://files.pythonhosted.org/packages/53/7f/bfb4797a7768f33e29728ab396a2a864c70dd8ff0535860383e1551f7afa/directory_sso_api_client-7.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-19 21:16:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "uktrade",
    "github_project": "directory-sso-api-client",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "circle": true,
    "lcname": "directory-sso-api-client"
}
        
Elapsed time: 0.16210s