Skip to main content

python-dciauth

DCI authentication module used by dci-control-server and python-dciclient

This section shows example programs written in python that illustrate how to work with Signature Version 2 in DCI. The algorithm used by dciauth is identical to Signature Version 4 in AWS.

Authentication example:

GET

import requests

from dciauth.v2.headers import generate_headers

headers = generate_headers(
    {"endpoint": "/api/v1/jobs"},
    {"access_key": "remoteci/client_id", "secret_key": "secret"},
)
requests.get("http://api.distributed-ci.io/api/v1/jobs", headers=headers)

POST

import requests

from dciauth.v2.headers import generate_headers

data = {"name": "user 1"}
headers = generate_headers(
    {
        "method": "POST",
        "endpoint": "http://api.distributed-ci.io/api/v1/users",
        "data": data,
    },
    {"access_key": "remoteci/client_id", "secret_key": "secret"},
)
requests.post("http://api.distributed-ci.io/api/v1/users", headers=headers, json=data)

Validation example

    from flask import request

    from dciauth.v2.headers import parse_headers
    from dciauth.v2.signature import is_valid

    valid, error_message = is_valid(
        {
            "method": request.method,
            "endpoint": request.path,
            "data": request.data,
            "params": request.args.to_dict(flat=True),
        },
        {"secret_key": "secret"},
        parse_headers(request.headers),
    )
    if not valid:
        raise Exception("Authentication failed: %s" % error_message)

Using POSTMAN

If you are using POSTMAN to discover DCI API you can use the following parameters with the AWS Signature authorization header:

GET https://api.distributed-ci.io/api/v1/identity
AccessKey=<DCI_CLIENT_ID>
SecretKey=<DCI_API_SECRET>
AWS Region="BHS3"
Service Name="api"

License

Apache 2.0

Author Information

Distributed-CI Team distributed-ci@redhat.com

Metadata

Release files for dciauth 3.0.2.post202311101437

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dciauth 3.0.2.post202311101437
File Size Uploaded Provenance Actions
dciauth-3.0.2.post202311101437.tar.gz 11.5 kB Without provenance Details for dciauth-3.0.2.post202311101437.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dciauth 3.0.2.post202311101437
File Interpreter ABI Platform Actions
dciauth-3.0.2.post202311101437-py3-none-any.whl Python 3 none any Details for dciauth-3.0.2.post202311101437-py3-none-any.whl

Total release size: 24.7 kB

Release files / dciauth-3.0.2.post202311101437.tar.gz

Download URL dciauth-3.0.2.post202311101437.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8ef7b423fac995d691760e184ea3d93eedc88cb1df7dbdee8410eaef35a3ce1a
BLAKE2b-256 checksum
How to use checksums
3752bee7deaf8cf8daf0293ee1bd5e43fcfb21c5dc37038c2ed29cc8f8cb4bba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / dciauth-3.0.2.post202311101437-py3-none-any.whl

Download URL dciauth-3.0.2.post202311101437-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4af0f89375a283166546edcb72210e9447e7b9364c3bff7a602eb471493542f5
BLAKE2b-256 checksum
How to use checksums
515e7f0b74fa9368be61884b14f2d1e9037f39564a0e54f384fc70bc48d051df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Security for dciauth 3.0.2.post202311101437

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page