Bootstrap CLI for provisioning cloud resources
Project description
remove the existing package: rm -rf build/ dist/ *.egg-info build again: python -m build
upload to pypi: twine upload dist/*
📦 Overview
The CLI now supports:
- 🔐 Secure login via browser-based device authorization (OAuth2-compliant)
- 🏢 Organization-scoped login (per session)
- 🔁 Automatic token refresh using offline tokens
- 👤 User context inspection (
whoami) - 👋 Session clearing (
logout)
🧑💻 Commands
All auth-related commands are grouped under:
intctl auth <subcommand>
1. 🔐 intctl auth login
Start login flow via browser:
intctl auth login
Flow:
-
Prompts for organization ID or name
-
Opens Keycloak device login via browser
-
User authenticates (e.g., via password or IdP)
-
Token is issued and saved locally:
access_token: short-livedrefresh_token: long-livedusername,org: stored with token
Stored at: ~/.intctl_token
2. 🧾 intctl auth whoami
Displays the current authenticated user and selected organization:
intctl auth whoami
Output:
👤 User: saeid
🏢 Org: org-abc
3. 🚪 intctl auth logout
Clears the local session:
intctl auth logout
This deletes the token and org information stored in ~/.intctl_token.
🔁 Token Refresh
The CLI automatically refreshes your token when it's near expiry:
- Refreshes if token expires in less than 60 seconds
- Uses stored
refresh_token(offline token) - Seamless; no user input required
🔧 Use in Code
from login import get_valid_access_token
headers = {
"Authorization": f"Bearer {get_valid_access_token()}",
"X-Org": load_login_data()["org"]
}
🗂️ Token Storage Format
Stored as JSON at ~/.intctl_token:
{
"access_token": "eyJhbGci...",
"refresh_token": "eyJhbGci...",
"username": "saeid",
"org": "intellithing"
}
🔐 Keycloak Client Configuration Summary
| Field | Value |
|---|---|
| Client Type | OpenID Connect (Public) |
| Device Auth Grant | ✅ Enabled |
| Offline Access Scope | ✅ Assigned |
| Access Type | Public |
🔄 Future Ideas (Optional Enhancements)
intctl auth switch-org: change org context without full re-login- Encrypt token file using
keyringor GPG - Add
intctl auth refresh(manual token refresh)
📎 Example Usage
intctl auth login
intctl configure
intctl setup
intctl auth whoami
intctl auth logout
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intctl-0.75.0.tar.gz.
File metadata
- Download URL: intctl-0.75.0.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5709f0a103a33e77bc35a91e36811b4125a7d9b1b89a10442ddd3d6efab26e09
|
|
| MD5 |
ea519f2cb7977f97d9b31ccf72ad69b8
|
|
| BLAKE2b-256 |
36a0a1da302f7513b56ee56194a33cb2457780fc8f8b4c8b9e15c92737c941f9
|
File details
Details for the file intctl-0.75.0-py3-none-any.whl.
File metadata
- Download URL: intctl-0.75.0-py3-none-any.whl
- Upload date:
- Size: 60.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d167f82dbc10f12962e40b939cdbc9465c0cc57340be9798030384da97fe724
|
|
| MD5 |
53625c529ecb44e36e258ab9f207985d
|
|
| BLAKE2b-256 |
cc340b9e6f51741c0de808e29c8df74ac1ec71ef9930cfcc4ace5671a34ccff2
|