Skip to content

Commit d7c2fb5

Browse files
committed
Documentation updates
1 parent a4953de commit d7c2fb5

8 files changed

Lines changed: 568 additions & 840 deletions

File tree

README.md

Lines changed: 362 additions & 183 deletions
Large diffs are not rendered by default.

docs/architecture.md

Lines changed: 106 additions & 107 deletions
Large diffs are not rendered by default.

docs/development-guide.md

Lines changed: 0 additions & 493 deletions
This file was deleted.

docs/index.md

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
55
## Project Overview
66

7-
**Type:** CLI (Python command-line tool)
8-
**Language:** Python 3.10+
9-
**Architecture:** Modular authentication system with pluggable MFA providers
7+
**Type:** CLI (Python command-line tool)
8+
**Language:** Python 3.10+
9+
**Architecture:** Modular authentication system with pluggable MFA providers
1010
**Released Version:** 2.8.2
1111
**Latest Version:** 2.9.0-pre
1212

@@ -15,18 +15,17 @@
1515
| Property | Value |
1616
|----------|-------|
1717
| **Tech Stack** | Python 3.10+, boto3, requests, fido2 |
18-
| **Entry Point** | `bin/gimme-aws-creds``gimme_aws_creds.main` |
19-
| **Config File** | `~/.okta_aws_login_config` |
20-
| **Output** | `~/.aws/credentials` or stdout |
18+
| **Entry Point** | `bin/gimme-aws-creds` -> `gimme_aws_creds.main` |
19+
| **Config File** | `~/.okta_aws_login_config` (override via `OKTA_CONFIG`) |
20+
| **AWS Output** | `~/.aws/credentials` or stdout |
21+
| **Alibaba Cloud Output** | `~/.aliyun/config.json` or stdout (override via `ALIBABA_CLOUD_SHARED_CREDENTIALS_FILE`) |
2122

2223
## Generated Documentation
2324

2425
### Core Documentation
2526

2627
- [Project Overview](./project-overview.md) - Executive summary, features, tech stack
2728
- [Architecture](./architecture.md) - System design, components, authentication flows
28-
- [Source Tree Analysis](./source-tree-analysis.md) - Directory structure, module responsibilities
29-
- [Development Guide](./development-guide.md) - Setup, testing, contributing
3029

3130
## Existing Documentation
3231

@@ -62,47 +61,72 @@ gimme-aws-creds --action-configure
6261

6362
# Get credentials
6463
gimme-aws-creds
64+
65+
# Debug a configuration / authentication issue
66+
gimme-aws-creds --debug
6567
```
6668

6769
## Module Quick Reference
6870

6971
| Module | Purpose |
7072
|--------|---------|
71-
| `main.py` | Main orchestrator, credential handling |
72-
| `common.py` | Shared utilities: HTTP session factory, SAML parsing, User-Agent, `OktaHttpMixin`, token exchange |
73-
| `config.py` | Configuration management |
73+
| `main.py` | Main orchestrator, credential handling, AWS/AliCloud dispatch |
74+
| `common.py` | Shared utilities: HTTP session factory, SAML parsing, `user_agent()`, `request_headers_json()`, `OktaHttpMixin`, `okta_token_exchange()`, `FakeAssertion`, `RoleSet` |
75+
| `config.py` | Configuration management (CLI args, profiles, env vars, source tracking for `--debug`) |
76+
| `debug_formatter.py` | HTTP request/response debug formatting, sensitive-data redaction, resolved-configuration reporting |
7477
| `okta_classic.py` | Okta Classic authentication + MFA |
75-
| `okta_identity_engine.py` | Okta Identity Engine (OIE) auth |
76-
| `aws.py` | AWS role resolution, SAML parsing |
77-
| `alibaba_cloud.py` | Alibaba Cloud (AliCloud) RAM credential support |
78-
| `duo.py` / `duo_universal.py` | DUO MFA handlers |
79-
| `webauthn.py` / `u2f.py` | FIDO/hardware key MFA |
80-
| `ui.py` | User interface abstraction |
78+
| `okta_identity_engine.py` | Okta Identity Engine (OIE) auth via Device Authorization flow |
79+
| `aws.py` | AWS role resolution, SAML parsing, account-alias lookup |
80+
| `alibaba_cloud.py` | Alibaba Cloud (AliCloud) RAM credential support (Native-to-Web SSO) |
81+
| `duo.py` / `duo_universal.py` | DUO MFA handlers (iframe + Universal Prompt) |
82+
| `webauthn.py` / `dummy_webauthn.py` / `u2f.py` | FIDO2 / hardware key MFA (`dummy_webauthn.py` is a fallback used when WebAuthn is unavailable on the platform) |
83+
| `registered_authenticators.py` | Persists registered FIDO authenticator credential IDs |
84+
| `default.py` | Default `Resolver` implementation for app/role enumeration prompts |
85+
| `ui.py` | User interface abstraction (`UserInterface`, `CLIUserInterface`) |
8186
| `errors.py` | Exception hierarchy |
8287

8388
## Authentication Flows
8489

8590
### Okta Classic
86-
1. Username/password Okta authn API
91+
1. Username/password -> Okta authn API
8792
2. MFA challenge (if required)
88-
3. Session token SAML assertion
89-
4. AWS STS Temporary credentials
93+
3. Session token -> SAML assertion
94+
4. AWS STS -> Temporary credentials
9095

9196
### Okta Identity Engine
9297
1. Device authorization request
9398
2. User authenticates in browser
94-
3. Token exchange → Web SSO token
95-
4. SAML assertion → AWS STS
99+
3. Token exchange -> Web SSO token
100+
4. SAML assertion -> AWS STS (or Alibaba Cloud STS for AliCloud profiles)
101+
102+
## Cloud Provider Support
103+
104+
| Provider | Auth Flow | STS API | Output |
105+
|----------|-----------|---------|--------|
106+
| **AWS** | Classic or OIE | `sts:AssumeRoleWithSAML` (boto3) | `~/.aws/credentials` |
107+
| **Alibaba Cloud** | OIE only (Native-to-Web SSO) | RAM `AssumeRoleWithSAML` (alibabacloud-sts SDK) | `~/.aliyun/config.json` |
108+
109+
Alibaba Cloud support is opt-in via the `gimme-aws-creds[alicloud]` extra and the `enable_alicloud` profile setting.
96110

97111
## Key Integration Points
98112

99-
- **Okta APIs**: `/api/v1/authn`, `/oauth2/v1/*`
100-
- **AWS STS**: `assume_role_with_saml`
101-
- **DUO Security**: iframe/Universal Prompt flows
102-
- **FIDO2**: Hardware authenticator support
113+
- **Okta APIs**: `/api/v1/authn`, `/oauth2/v1/device/authorize`, `/oauth2/v1/token`
114+
- **AWS STS**: `assume_role_with_saml` (standard, GovCloud, and China partitions)
115+
- **Alibaba Cloud STS**: `AssumeRoleWithSAML` (1 hour session cap)
116+
- **DUO Security**: iframe + Universal Prompt flows
117+
- **FIDO2 / WebAuthn**: Hardware authenticator support via `fido2` and `ctap-keyring-device`
118+
119+
## Debug & Troubleshooting
120+
121+
The `--debug` flag enables structured HTTP request/response logging via `debug_formatter.py`:
122+
123+
- Colorized request/response sections written to stderr
124+
- Sensitive fields (`access_token`, `id_token`, `sessionToken`, `stateToken`, `password`, `SAMLResponse`, `SAMLAssertion`, `passCode`, `Authorization`, `Cookie`, etc.) are redacted
125+
- Embedded `AssumeRoleWithSAMLResponse` payloads from AWS STS are redacted
126+
- A "Resolved Configuration" report shows the final config values and the source of each (CLI flag, env var, profile, inheritance, default)
103127

104128
---
105129

106-
*Documentation generated: 2026-01-09*
107-
*Last updated: 2026-04-05*
130+
*Documentation generated: 2026-01-09*
131+
*Last updated: 2026-05-05*
108132
*Scan level: exhaustive*

docs/project-overview.md

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Executive Summary
44

5-
**gimme-aws-creds** is a Python CLI tool that acquires temporary AWS credentials via AWS STS using Okta as a SAML Identity Provider (IdP). It supports both Okta Classic and Okta Identity Engine authentication flows with comprehensive MFA support.
5+
**gimme-aws-creds** is a Python CLI tool that acquires temporary AWS credentials via AWS STS using Okta as a SAML Identity Provider (IdP). It supports both Okta Classic and Okta Identity Engine authentication flows with comprehensive MFA support, and can also retrieve Alibaba Cloud RAM credentials via the same Okta authentication flow.
66

77
## Project Metadata
88

@@ -23,54 +23,73 @@ Organizations using Okta for SSO to AWS need a way to obtain temporary AWS crede
2323
1. Authenticating users via Okta (Classic or Identity Engine)
2424
2. Handling multi-factor authentication (MFA) flows
2525
3. Retrieving SAML assertions from Okta
26-
4. Exchanging SAML assertions for AWS STS temporary credentials
27-
5. Writing credentials to `~/.aws/credentials` or outputting to stdout
26+
4. Exchanging SAML assertions for AWS STS (or Alibaba Cloud RAM) temporary credentials
27+
5. Writing credentials to `~/.aws/credentials` (or `~/.aliyun/config.json`) or outputting to stdout
2828

2929
## Key Features
3030

3131
- **Dual Okta Platform Support**: Works with both Okta Classic and Okta Identity Engine domains
32-
- **Comprehensive MFA**: Push, TOTP, SMS, Email, Voice Call, DUO, WebAuthn, U2F, Hardware Tokens
33-
- **Multiple Output Formats**: Shell exports, JSON, Windows PowerShell
34-
- **Profile Management**: Multiple configuration profiles with inheritance
35-
- **AWS Account Resolution**: Resolves account IDs to friendly aliases
36-
- **Credential Storage**: Automatic storage in AWS credentials file with expiration tracking
37-
- **Lambda Integration**: Optional gimme-creds-lambda proxy for API key-less operation
32+
- **Comprehensive MFA**: Push, TOTP, SMS, Email, Voice Call, DUO (iframe + Universal Prompt), WebAuthn, U2F, hardware tokens
33+
- **Multi-Cloud Output**: AWS STS (standard, GovCloud, China partitions) and Alibaba Cloud RAM
34+
- **Multiple Output Formats**: Shell exports (`export`), JSON, Windows PowerShell (`windows`)
35+
- **Profile Management**: Multiple configuration profiles with inheritance via `inherits = parent_profile`
36+
- **AWS Account Resolution**: Resolves account IDs to friendly aliases by scraping the AWS sign-in page
37+
- **Credential Storage**: Automatic storage in AWS credentials file with `x_security_token_expires` (RFC3339) for expiration tracking
38+
- **Lambda Integration**: Optional [gimme-creds-lambda](https://github.com/Nike-Inc/gimme-aws-creds/tree/master/lambda) proxy for API key-less operation
39+
- **Debug & Diagnostics**: `--debug` produces structured request/response logs and a "Resolved Configuration" report (with source attribution: CLI / env / profile / default), with automatic redaction of sensitive payloads (SAML responses, OAuth tokens, passwords, authorization headers)
40+
- **Source-Attribution Tracking**: `Config` records, per value, whether it came from a CLI flag, environment variable, profile setting, inherited profile, or default
3841

3942
## Technology Stack
4043

4144
| Category | Technology | Version |
4245
|----------|------------|---------|
4346
| **Language** | Python | `3.10+` |
44-
| **AWS SDK** | boto3 | `>=1.7.70,<2.0.0` |
45-
| **HTTP** | requests | `>=2.25.0,<3.0.0` |
46-
| **HTML Parsing** | beautifulsoup4 | `>=4.6.0,<5.0.0` |
47-
| **Okta SDK** | okta | `>=2.9.0,<3.0.0` |
48-
| **FIDO2/WebAuthn** | fido2 | `>=0.9.1,<0.10.0` |
49-
| **JWT** | pyjwt | `>=2.4.0,<3.0.0` |
50-
| **Keyring** | keyring | `>=21.4.0` |
47+
| **AWS SDK** | boto3 | `>=1.42.24,<2.0.0` |
48+
| **HTTP** | requests | `>=2.31.0,<3.0.0` |
49+
| **HTTP transport** | urllib3 | `>=2.6.3,<3.0.0` |
50+
| **HTML Parsing** | beautifulsoup4 | `>=4.14.3,<5.0.0` |
5151
| **HTML5** | html5lib | `>=1.1,<2.0.0` |
52+
| **Okta SDK** | okta | `>=2.9.13,<3.0.0` |
53+
| **FIDO2/WebAuthn** | fido2 | `>=0.9.1,<0.10.0` |
54+
| **CTAP keyring (FIDO via system keychain)** | ctap-keyring-device | `==1.0.6` (non-Win or Python <3.10 on Windows) |
55+
| **JWT** | pyjwt | `>=2.10.1,<3.0.0` |
56+
| **Keyring** | keyring | `>=25.6.0,<26.0.0` |
5257
| **URL Parsing** | furl | `>=2.1.4,<3.0.0` |
58+
| **(Optional) Alibaba Cloud STS** | alibabacloud-sts20150401 | `>=1.2.0,<2.0.0` (extras `[alicloud]`) |
59+
60+
### Development / Test Dependencies
61+
62+
| Tool | Purpose |
63+
|------|---------|
64+
| `pytest` (`>=7.2.2`) | Unit test runner |
65+
| `responses` (`>=0.5.1,<1.0.0`) | HTTP mocking for `requests` |
66+
| `alibabacloud_sts20150401` | Required for `tests/test_alibaba_cloud.py` |
5367

5468
## Architecture Pattern
5569

5670
The project follows a **Command-Line Application Pattern** with:
71+
5772
- Modular authentication providers (Okta Classic, Okta Identity Engine)
58-
- Pluggable MFA factor handlers
59-
- Strategy pattern for AWS role resolution
60-
- Dependency injection for UI abstraction
61-
- Shared utility layer (`common.py`) for HTTP session management, SAML parsing, and cross-cutting concerns
73+
- Pluggable MFA factor handlers (Okta factors, DUO, FIDO2, U2F)
74+
- Strategy pattern for AWS / Alibaba Cloud role resolution (`DefaultResolver`)
75+
- Dependency injection for UI abstraction (`UserInterface`)
76+
- Shared utility layer (`common.py`) for HTTP session management, SAML parsing, OAuth token exchange, and cross-cutting concerns
6277
- Mixin-based code reuse (`OktaHttpMixin`) for Okta HTTP client classes
78+
- Dedicated debug/diagnostics layer (`debug_formatter.py`) with sensitive-data redaction and configuration source attribution
79+
- Lazy-loaded, cached properties on `GimmeAWSCreds` (`config`, `okta`, `auth_session`, `aws_results`, `saml_data`, `aws_roles`)
6380

6481
## Installation Methods
6582

6683
1. **PyPI**: `pip install gimme-aws-creds`
67-
2. **GitHub**: `pip install git+github.com/Nike-Inc/gimme-aws-creds`
68-
3. **Homebrew**: `brew install gimme-aws-creds`
69-
4. **Nix**: Flake and shell.nix support
70-
5. **Docker**: Dockerfile included
84+
2. **PyPI (with Alibaba Cloud)**: `pip install "gimme-aws-creds[alicloud]"`
85+
3. **GitHub**: `pip install git+https://github.com/Nike-Inc/gimme-aws-creds`
86+
4. **Homebrew (macOS)**: `brew install gimme-aws-creds`
87+
5. **Nix**: `flake.nix` (`nix develop`) and `shell.nix` (`nix-shell`) provided
88+
6. **Docker**: `Dockerfile` included; mount `~/.aws/credentials` and `~/.okta_aws_login_config` into the container
7189

7290
## Related Documentation
7391

7492
- [Architecture](./architecture.md)
75-
- [Source Tree Analysis](./source-tree-analysis.md)
76-
- [Development Guide](./development-guide.md)
93+
- [README.md](../README.md) - End-user documentation
94+
- [CONTRIBUTING.md](../CONTRIBUTING.md) - Contribution guide
95+
- [lambda/README.md](../lambda/README.md) - Optional gimme-creds-lambda proxy

gimme_aws_creds/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def update_config_file(self):
327327
preferred_mfa_type = (optional, Okta Classic only) Select this MFA device type automatically
328328
include_path - (optional) includes the full role path to the role name for profile
329329
enable_keychain = (optional, Okta Classic only) enable the use of the system keychain to store the user's password
330-
enable_alicloud = (optional, OIE only) y/n use Native-to-Web SSO scope for Alibaba Cloud RAM
330+
enable_alicloud = (optional, OIE only) y/n - use Native-to-Web SSO scope for Alibaba Cloud RAM
331331
alicloud_saml_url = (optional, Alibaba Cloud only) explicit SAML SSO URL for the Alibaba Cloud app in Okta; falls back to the app link if not set
332332
alicloud_region = (optional, Alibaba Cloud only) Alibaba Cloud STS region used for AssumeRoleWithSAML (default: cn-hangzhou)
333333

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-r requirements.txt
2-
# Optional Alibaba Cloud SDK (matches setup.py extras_require['alicloud']) needed for Alibaba Cloud STS tests
2+
# Optional Alibaba Cloud SDK (matches setup.py extras_require['alicloud']) - needed for Alibaba Cloud STS tests
33
alibabacloud_sts20150401>=1.2.0,<2.0.0
44
responses>=0.5.1,<1.0.0
55
pytest>=7.2.2

tests/test_debug_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def test_env_okta_config_path_label(self):
200200
argv=['--profile', 'myprofile'],
201201
)
202202
# Reuse the config file already on disk under test_ui2.HOME? Not
203-
# quite env points to the original cfg_path.
203+
# quite - env points to the original cfg_path.
204204
config = Config(gac_ui=test_ui2, create_config=False)
205205
config.conf_profile = 'myprofile'
206206
conf_dict = config.get_config_dict()

0 commit comments

Comments
 (0)