Skip to main content

Apache Custos Python SDK

The Apache Custos Python SDK for third party clients to integrate with Custos middleware

Folder Structure

  • custos

    Includes gRPC stubs generated by a protoc compiler. Mainly contains data model and functions. You may need to import data model packages to integrate with clients.

  • clients

    Includes integration clients, which you want to import and integrate with your code to access Custos middleware.

  • samples

    Includes set of sample implementation of integration clients to demo the integration with Custos middleware

  • transport

    Includes connection handling classes

Before Integration

  • Create a virtual environment

    python3 -m venv venv
    
  • Activate the virtual environment

    source venv/bin/activate
    
  • Install dependencies

    pip install -r requirements.txt
    
  • Create a INI file containing server configuration details. For more information refer to default settings file

    settings.ini

Generating Distribution Archives (Optional)

You can generate *.tar.gz or .whl distribution and install to any external project.

  • Create a virtual environment

    python3 -m venv venv
    
  • Activate the virtual environment

    source venv/bin/activate
    
  • Make sure you have the latest versions of setuptools and wheel installed

    pip install  wheel
    
  • Now run this command from the same directory where setup.py is located

    python3 setup.py sdist bdist_wheel
    
  • This command should output a lot of text and once completed should generate two files in the dist directory

    dist/
        custos_python_sdk-1.0.0-py3-none-any.whl
        custos-python-sdk-1.0.0.tar.gz
    

You should be able to install those packages into your project.

Integrate With Your Clients

There are three types of tokens used for access custos APIs.

  • Client Token (Base64 encoded Custos_Client_Id +":"+ Custos_Client_Sec)

  • Admin Token (Access Token of Admin User)

  • User Token (Access Token of Generic User)

  • tenant_management_client

    • create_admin_tenant (client_name, requester_email, admin_frist_name, admin_last_name, admin_email, admin_username, admin_password, contacts, redirect_uris, client_uri, scope, domain, logo_uri, comment)
    • create_tenant (client_token, client_name, requester_email, admin_frist_name, admin_last_name, admin_email, admin_username, admin_password, contacts, redirect_uris, client_uri, scope, domain, logo_uri, comment)
    • get_credentials (client_token)
    • get_tenant (client_token, client_id)
    • update_tenant (client_token, client_id, client_name, requester_email, admin_frist_name, admin_last_name, admin_email, admin_username, admin_password, contacts, redirect_uris, client_uri, scope, domain, logo_uri, comment)
    • delete_tenant (client_token, client_id)
    • add_tenant_roles (client_token, roles, is_client_level)
    • add_protocol_mapper (client_token, roles, is_client_level)
    • get_child_tenants ( client_token, offset, limit, status)
    • get_all_tenants ( client_token, email)

Sample implementations can be found at tenant_management_samples

  • identity_management_client

    • authenticate(client_token, username, password)
    • is_authenticated( client_token, user_access_token, username)
    • get_service_account_access_token( client_token)
    • authorize( client_id, redirect_uri, response_type, scope, state)
    • token( client_token, redirect_uri, code)
    • get_credentials( client_token, client_id)
    • get_oidc_configuration( client_token, client_id)

Sample implementations can be found at identity_management_sample

  • user_management_client

    • register_user(client_token, username, first_name, last_name, password, email, is_temp_password)
    • register_and_enable_users( admin_token, users)
    • add_user_attributes( user_token, attributes, users)
    • delete_user_attributes( user_token, attributes, users)
    • enable_user( client_token, username)
    • add_roles_to_users( admin_token, usernames, roles, is_client_level)
    • is_user_enabled( client_token, username)
    • is_username_available( client_token, username)
    • get_user( client_token, username)
    • find_users( client_token, offset, limit, username=None, firstname=None, lastname=None, email=None)
    • reset_password( client_token, username, password)
    • delete_user( admin_token, username)
    • delete_user_roles( admin_token, username, client_roles, realm_roles)
    • update_user_profile( user_token, username, email, first_name, last_name)

Sample implementations can be found at user_management_samples

  • super_tenant_management_client

    • get_all_tenants( super_admin_token, offset, limit, status)
    • update_tenant_status( super_admin_token, client_id, status)

Metadata

Release files for custos-sdk 1.0.18

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

Built distribution (wheel)

Table of built distributions (wheels) for custos-sdk 1.0.18
File Interpreter ABI Platform
custos_sdk-1.0.18-py3-none-any.whl Python 3 none any Details

Release files / custos_sdk-1.0.18-py3-none-any.whl

Download URL custos_sdk-1.0.18-py3-none-any.whl
Size 173.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7157d8e2b303e6698c7f89e644206b7ada4ed98574f4a3a211b6e371ce895da
BLAKE2b-256 checksum
How to use checksums
48485e6c8711d046c1babe568d4b67db3ccc4b48be82fe973df04582bc974e7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.4

Security for custos-sdk 1.0.18

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