Skip to main content

Apache Custos Python SDK

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

custos_sdk-1.0.18-py3-none-any.whl (173.2 kB view details)

Uploaded Python 3

File details

Details for the file custos_sdk-1.0.18-py3-none-any.whl.

File metadata

  • Download URL: custos_sdk-1.0.18-py3-none-any.whl
  • Upload date:
  • Size: 173.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for custos_sdk-1.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 f7157d8e2b303e6698c7f89e644206b7ada4ed98574f4a3a211b6e371ce895da
MD5 912b946a341d5470f14d1f86f5f9aa67
BLAKE2b-256 48485e6c8711d046c1babe568d4b67db3ccc4b48be82fe973df04582bc974e7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page