Skip to main content

A simple CLI utility for automating token generations with kubernetes.

Project description

Configure Azure CLI from CLI or Environment Variables

# 1. Authenticate with Azure CLI Creds from Terminal 
az login 

# 2. Authenticate with Environmental variables
export AZURE_CLIENT_ID="*******"
export AZURE_TENANT_ID="*******"
export AZURE_CLIENT_SECRET="*******"

# Make sure Role has Azurekeyvault read/write permissions

Authenticate with Gitlab Registry

# In order not to be passing flags for the gitlab credentials, export them once on your terminal session
export username="*******"
export email="*******"
export password="*******"

How to Setup

# Create virtual environment -- Optional
python -m venv venv && source venv/bin/activate

# Install via pip
pip install tokengen

# Check commands and subcommands
tokengen -h

# Available subcommands
tokengen generate               # To create 4 Tokens at Once
tokengen bridgetoken            # To optionally create Bridgetoken later

How to generate tokens

# Create and Store 4 Tokens in Azurekeyvault at ONCE -- Optional(bridgetoken)
# 1. AIFI_API_TOKEN and PEPPER Token as retailere>-cloud-oasis-api-retailer-token
# 2. KEYCLOAK credentials as <retailer>-cloud-keycloak-admin
# 3. RETAILER_TOKEN and oasis-api-token secret as <retailer>-cloud-oasis-api-token
# 4. RETAILER_BRIDGE_TOKEN as <store-id>-retailer-bridge-token

Generate 4 Tokens at ONCE

# --btoken is optional if you want to generate a Bridgetoken, else just elimimate it from the --flags
tokengen generate --vault <vault_name> \
        --vault_url <vault_url> \
        --secret <secret_name> \
        --domain <store-domain-prefix> \
        --btoken ronaldo-express-003


# To Use Default credentials of keyvault, Run
tokengen generate --secret <retailer_name_example_zucchini> --domain holtebar

Generate Bridgetoken separately

# tokengen bridgetoken --btoken <store-id>
tokengen bridgetoken --btoken umari-express-0001

Why Python Secrets?

# From Python Docs
The secrets module is used for generating cryptographically strong random numbers suitable for managing data such as passwords, account authentication, security tokens, and related secrets.

In particularly, secrets should be used in preference to the default pseudo-random number generator in the random module, which is designed for modelling and simulation, not security or cryptography.

To Contribute, Setup Environment

# create venv
python3 -m venv venv

# Activate the venv
source venv/bin/activate

# Install packages
pip install -r requirements.txt

# Switch to developer mode
python3 setup.py develop

# To test with your Azure keyvault, pass these flags to bypass default flags set for keyvault
--vault
--vault_url

Project details


Download files

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

Source Distribution

tokengen-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

tokengen-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tokengen-0.1.1.tar.gz.

File metadata

  • Download URL: tokengen-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for tokengen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 08d1e9c0847b9d3478c3a039f85059ede14054d07ed27cd47ee00ba8d2f317ee
MD5 3273404f13fe14e2dd35a6c6eb7ec9be
BLAKE2b-256 cf7533a0ec7d483d37245bd99b0f72de1c097146ddde85f831080b4770e5777b

See more details on using hashes here.

File details

Details for the file tokengen-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tokengen-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for tokengen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a32028374d8554f4b3121e631e3b0c05425cfcb62927ea33f934af95b2efcb94
MD5 3e537cf379dee3d2b4331e187d53afc8
BLAKE2b-256 88a0d3f78dcf8185b3516ea872cbe25ae5e9c11a303c96f80697153b6ac7f572

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