Skip to content

Commit f5c9926

Browse files
docs(providers): add JWT Bearer Authorization documentation
- Add comprehensive JWT authentication section to AUTHENTICATION.md - Document JWT setup flow, token provision methods, and validation - Include CI/CD pipeline examples and troubleshooting guide - Add JWT vs SSO comparison table - Update README.md to mention JWT Bearer Auth in provider list Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
1 parent 2ca0523 commit f5c9926

2 files changed

Lines changed: 150 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![TypeScript](https://img.shields.io/badge/TypeScript-5.3%2B-blue.svg)](https://www.typescriptlang.org/)
1111
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
1212

13-
> **Unified AI Coding Assistant CLI** - Manage Claude Code, Google Gemini, OpenCode, and custom AI agents from one powerful command-line interface. Multi-provider support (OpenAI, Azure OpenAI, AWS Bedrock, LiteLLM, Ollama, Enterprise SSO). Built-in LangGraph agent with file operations, command execution, and planning tools. Cross-platform support for Windows, Linux, and macOS.
13+
> **Unified AI Coding Assistant CLI** - Manage Claude Code, Google Gemini, OpenCode, and custom AI agents from one powerful command-line interface. Multi-provider support (OpenAI, Azure OpenAI, AWS Bedrock, LiteLLM, Ollama, Enterprise SSO, JWT Bearer Auth). Built-in LangGraph agent with file operations, command execution, and planning tools. Cross-platform support for Windows, Linux, and macOS.
1414
1515
---
1616

@@ -23,10 +23,10 @@
2323
CodeMie CLI is the all-in-one AI coding assistant for developers.
2424

2525
-**One CLI, Multiple AI Agents** - Switch between Claude Code, Gemini, OpenCode, and built-in agent.
26-
- 🔄 **Multi-Provider Support** - OpenAI, Azure OpenAI, AWS Bedrock, LiteLLM, Ollama, and Enterprise SSO.
26+
- 🔄 **Multi-Provider Support** - OpenAI, Azure OpenAI, AWS Bedrock, LiteLLM, Ollama, Enterprise SSO, and JWT Bearer Auth.
2727
- 🚀 **Built-in Agent** - A powerful LangGraph-based assistant with file operations, command execution, and planning tools.
2828
- 🖥️ **Cross-Platform** - Full support for Windows, Linux, and macOS with platform-specific optimizations.
29-
- 🔐 **Enterprise Ready** - SSO authentication, audit logging, and role-based access.
29+
- 🔐 **Enterprise Ready** - SSO and JWT authentication, audit logging, and role-based access.
3030
-**Productivity Boost** - Code review, refactoring, test generation, and bug fixing.
3131
- 🎯 **Profile Management** - Manage work, personal, and team configurations separately.
3232
- 📊 **Usage Analytics** - Track and analyze AI usage across all agents with detailed insights.

docs/AUTHENTICATION.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Authentication & SSO Management
22

3+
## Authentication Methods
4+
5+
CodeMie CLI supports multiple authentication methods:
6+
7+
- **CodeMie SSO** - Browser-based Single Sign-On (recommended for enterprise)
8+
- **JWT Bearer Authorization** - Token-based authentication for CI/CD and external auth systems
9+
- **API Key** - Direct API key authentication for other providers (OpenAI, Anthropic, etc.)
10+
311
## AI/Run CodeMie SSO Setup
412

513
For enterprise environments with AI/Run CodeMie SSO (Single Sign-On):
@@ -103,3 +111,142 @@ AI/Run CodeMie SSO provides enterprise-grade features:
103111
- **Automatic Plugin Installation**: Claude Code plugin auto-installs for session tracking
104112
- **Audit Logging**: Enterprise audit trails for security compliance
105113
- **Role-Based Access**: Model access based on organizational permissions
114+
115+
## JWT Bearer Authorization
116+
117+
For environments with external token management systems, CI/CD pipelines, or testing scenarios, CodeMie CLI supports JWT Bearer Authorization. This method provides tokens at runtime rather than during setup.
118+
119+
### Initial Setup
120+
121+
JWT setup only requires the API URL - tokens are provided later:
122+
123+
```bash
124+
codemie setup
125+
# Select: Bearer Authorization
126+
```
127+
128+
**The wizard will:**
129+
1. Prompt for the CodeMie base URL (e.g., `https://codemie.lab.epam.com`)
130+
2. Optionally ask for a custom environment variable name (default: `CODEMIE_JWT_TOKEN`)
131+
3. Save the configuration without requiring a token
132+
4. Display instructions for providing tokens at runtime
133+
134+
### Providing JWT Tokens
135+
136+
After setup, provide tokens via environment variable or CLI option:
137+
138+
**Environment Variable (Recommended):**
139+
```bash
140+
# Set token in your environment
141+
export CODEMIE_JWT_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
142+
143+
# Run commands normally
144+
codemie-claude "analyze this code"
145+
```
146+
147+
**CLI Option:**
148+
```bash
149+
# Provide token per command
150+
codemie-claude --jwt-token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." "analyze this code"
151+
```
152+
153+
**Custom Environment Variable:**
154+
```bash
155+
# If you configured a custom env var during setup
156+
export MY_CUSTOM_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
157+
codemie-claude "analyze this code"
158+
```
159+
160+
### JWT Token Management
161+
162+
JWT tokens are validated automatically:
163+
164+
```bash
165+
# Check JWT authentication status
166+
codemie doctor
167+
168+
# View token status and expiration
169+
codemie profile status
170+
```
171+
172+
**Token Validation:**
173+
- Format validation (header.payload.signature)
174+
- Expiration checking (warns if expiring within 7 days)
175+
- Automatic error messages for expired tokens
176+
177+
### Use Cases
178+
179+
JWT Bearer Authorization is ideal for:
180+
181+
**CI/CD Pipelines:**
182+
```bash
183+
# GitLab CI example
184+
script:
185+
- export CODEMIE_JWT_TOKEN="${CI_JOB_JWT}"
186+
- codemie-claude --task "review changes in this commit"
187+
```
188+
189+
**External Auth Systems:**
190+
```bash
191+
# Obtain token from your auth provider
192+
TOKEN=$(curl -s https://auth.example.com/token | jq -r .access_token)
193+
194+
# Use with CodeMie
195+
codemie-claude --jwt-token "$TOKEN" "your prompt"
196+
```
197+
198+
**Testing & Development:**
199+
```bash
200+
# Use short-lived test tokens
201+
export CODEMIE_JWT_TOKEN="test-token-expires-in-1h"
202+
codemie-claude "run tests"
203+
```
204+
205+
### JWT vs SSO
206+
207+
| Feature | JWT Bearer Auth | CodeMie SSO |
208+
|---------|----------------|-------------|
209+
| **Setup** | URL only | Browser-based flow |
210+
| **Token Source** | Runtime (CLI/env) | Stored in keychain |
211+
| **Best For** | CI/CD, external auth | Interactive development |
212+
| **Token Refresh** | Manual (obtain new token) | Automatic |
213+
| **Security** | Token management external | Managed by CLI |
214+
215+
### Troubleshooting JWT
216+
217+
**Token not found:**
218+
```bash
219+
# Check environment variable
220+
echo $CODEMIE_JWT_TOKEN
221+
222+
# Verify variable name matches config
223+
codemie profile status
224+
225+
# Provide via CLI instead
226+
codemie-claude --jwt-token "your-token" "your prompt"
227+
```
228+
229+
**Token expired:**
230+
```bash
231+
# Obtain new token from your auth provider
232+
export CODEMIE_JWT_TOKEN="new-token-here"
233+
234+
# Verify expiration
235+
codemie doctor
236+
```
237+
238+
**Invalid token format:**
239+
```bash
240+
# JWT must have 3 parts (header.payload.signature)
241+
# Check token structure
242+
echo $CODEMIE_JWT_TOKEN | awk -F. '{print NF}' # Should output: 3
243+
```
244+
245+
**Configuration issues:**
246+
```bash
247+
# Reset and reconfigure
248+
codemie setup # Choose Bearer Authorization again
249+
250+
# Or manually edit config
251+
cat ~/.codemie/codemie-cli.config.json
252+
```

0 commit comments

Comments
 (0)