Programmatic Authentication with Bailo

Public Key Infrastructure

PKI is used to create a secure environment for authentication. You can use the Python Client to sign requests to Bailo.

from bailo import PkiAgent

pki_agent = PkiAgent()

Client("http://127.0.0.1:8080", cert="path/to/cert.pem", key="path/to/key.pem",
        auth="path/to/certificate/authority/file.pem") # <- INSERT BAILO URL (if not hosting locally)

# YOUR SCRIPT GOES HERE

Token Agents

If you are not using PKI then Bailo allows the usage of access tokens to allow for fine-grained access. Tokens are used to grant access to models within Bailo to specific models and specific actions. These can be found in Settings > Authentication.

To create a new access token, press Add token and select the options from below.

  • image:read Allows you to download images from Bailo
  • file:read Allows you to download files from Bailo

Copy and paste the Access key and Secret Key and store these safely.

The Python Client allows support for using access tokens. Instead of using the default Agent class you can use The TokenAgent class. The client works in the same way as before but will authenticate using access tokens.

from bailo import TokenAgent

ACCESS_KEY = xOHuJiwAZI
SECRET_KEY = OxJWI8FobvdhRFPQFRYXB

token_agent = TokenAgent(ACCESS_KEY, SECRET_KEY)

Client("http://127.0.0.1:8080", agent=token_agent) # <- INSERT BAILO URL (if not hosting locally)

# YOUR SCRIPT GOES HERE

Copyright © Crown Copyright 2024.