directory-sso-api-client
Installation
$ 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:
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
$ 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:
make publish
Metadata
Release files for directory-sso-api-client 8.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| directory_sso_api_client-8.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Release files / directory_sso_api_client-8.0.5-py3-none-any.whl
| Download URL | directory_sso_api_client-8.0.5-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bbb948c0eb4c4d9b80b952947ced9e58c899a19bd94f5952be3831201399b58
|
|
BLAKE2b-256 checksum How to use checksums |
243ef2c74205fa56c2ba417442d975ba89c66b808a08b1f3c253452ad6895c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|