Commit b5766115 authored by Your Name's avatar Your Name

Add proxy support for OAuth2 Chrome extension

parent fbb49301
...@@ -140,6 +140,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -140,6 +140,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- OAuth2 endpoints: `/dashboard/claude/auth/start`, `/dashboard/claude/auth/complete`, `/dashboard/claude/auth/status` - OAuth2 endpoints: `/dashboard/claude/auth/start`, `/dashboard/claude/auth/complete`, `/dashboard/claude/auth/status`
- Extension endpoints: `/dashboard/extension/download`, `/dashboard/oauth2/callback` - Extension endpoints: `/dashboard/extension/download`, `/dashboard/oauth2/callback`
- Comprehensive documentation in CLAUDE_OAUTH2_SETUP.md and CLAUDE_OAUTH2_DEEP_DIVE.md - Comprehensive documentation in CLAUDE_OAUTH2_SETUP.md and CLAUDE_OAUTH2_DEEP_DIVE.md
- Proxy-aware OAuth2 extension serving: detects X-Forwarded-For, X-Forwarded-Host, X-Real-IP headers
- Force interception mechanism: extension activates for localhost when OAuth flow initiated from dashboard
- Supports reverse proxy deployments (nginx, caddy, etc.) with automatic proxy detection
- **Kiro Provider Integration**: Native support for Kiro (Amazon Q Developer / AWS CodeWhisperer) - **Kiro Provider Integration**: Native support for Kiro (Amazon Q Developer / AWS CodeWhisperer)
- KiroAuth class (`aisbf/kiro_auth.py`) for AWS credential management - KiroAuth class (`aisbf/kiro_auth.py`) for AWS credential management
- Support for multiple authentication methods: - Support for multiple authentication methods:
......
...@@ -676,6 +676,9 @@ Model metadata is automatically extracted from provider responses and stored in ...@@ -676,6 +676,9 @@ Model metadata is automatically extracted from provider responses and stored in
- Full OAuth2 PKCE authentication flow - Full OAuth2 PKCE authentication flow
- Automatic token refresh with refresh token rotation - Automatic token refresh with refresh token rotation
- Chrome extension for remote server OAuth2 callback interception - Chrome extension for remote server OAuth2 callback interception
- Proxy-aware extension serving: automatically detects reverse proxy deployments via X-Forwarded-* headers
- Force interception mechanism: extension activates for localhost when OAuth flow initiated from dashboard
- Supports nginx, caddy, and other reverse proxies with automatic proxy detection
- Dashboard integration with authentication UI - Dashboard integration with authentication UI
- Credentials stored in `~/.aisbf/claude_credentials.json` - Credentials stored in `~/.aisbf/claude_credentials.json`
- Optional curl_cffi TLS fingerprinting for Cloudflare bypass - Optional curl_cffi TLS fingerprinting for Cloudflare bypass
...@@ -694,6 +697,14 @@ Model metadata is automatically extracted from provider responses and stored in ...@@ -694,6 +697,14 @@ Model metadata is automatically extracted from provider responses and stored in
- Supports IDE credentials and CLI authentication - Supports IDE credentials and CLI authentication
- Access to Claude models through Kiro - Access to Claude models through Kiro
- No separate API key required (uses Kiro credentials) - No separate API key required (uses Kiro credentials)
### Kilocode
- OAuth2 Device Authorization Grant flow
- Supports both API key and OAuth2 authentication
- Seamless integration with Kilocode services
- Dashboard OAuth2 authentication UI
- Credentials stored in ~/.kilo_credentials.json
- Access to Kilocode AI models and services
- Supports streaming, tool calling, and extended thinking - Supports streaming, tool calling, and extended thinking
## Rotation Models ## Rotation Models
......
...@@ -137,6 +137,34 @@ pip install aisbf ...@@ -137,6 +137,34 @@ pip install aisbf
sudo pip install aisbf sudo pip install aisbf
``` ```
## Post-Installation OAuth2 Setup
AISBF supports OAuth2 authentication for several providers:
### Claude (Anthropic)
- Full OAuth2 PKCE flow for Claude Code (claude.ai)
- Chrome extension for remote server deployments
- Proxy-aware: automatically detects reverse proxy deployments
- Dashboard integration for easy authentication
### Kiro (Amazon Q Developer)
- Native OAuth2 support for AWS CodeWhisperer
- Multiple authentication methods (IDE credentials, kiro-cli, direct refresh token)
- Automatic credential management
### Kilocode
- Device Authorization Grant OAuth2 flow
- Seamless integration with Kilocode services
**Setup Instructions:**
1. Start AISBF: `aisbf`
2. Access dashboard: `http://localhost:17765/dashboard`
3. Navigate to Providers section
4. Configure OAuth2 providers and follow authentication prompts
5. For remote deployments: Install Chrome extension from dashboard
For detailed OAuth2 setup, see README.md and DOCUMENTATION.md in the installed package.
## Troubleshooting ## Troubleshooting
### Build Errors ### Build Errors
......
...@@ -131,6 +131,7 @@ See [`PYPI.md`](PYPI.md) for detailed instructions on publishing to PyPI. ...@@ -131,6 +131,7 @@ See [`PYPI.md`](PYPI.md) for detailed instructions on publishing to PyPI.
- Claude Code (OAuth2 authentication via claude.ai) - Claude Code (OAuth2 authentication via claude.ai)
- Ollama (direct HTTP) - Ollama (direct HTTP)
- Kiro (Amazon Q Developer / AWS CodeWhisperer) - Kiro (Amazon Q Developer / AWS CodeWhisperer)
- Kilocode (OAuth2 Device Authorization Grant)
## Configuration ## Configuration
### SSL/TLS Configuration ### SSL/TLS Configuration
...@@ -287,6 +288,9 @@ AISBF supports Claude Code (claude.ai) as a provider using OAuth2 authentication ...@@ -287,6 +288,9 @@ AISBF supports Claude Code (claude.ai) as a provider using OAuth2 authentication
- Automatic token refresh with refresh token rotation - Automatic token refresh with refresh token rotation
- Chrome extension for remote server OAuth2 callback interception - Chrome extension for remote server OAuth2 callback interception
- Dashboard integration with authentication UI - Dashboard integration with authentication UI
- Proxy-aware extension serving: automatically detects reverse proxy deployments
- Force interception mechanism: extension activates for localhost when OAuth flow initiated from dashboard
- Supports nginx, caddy, and other reverse proxies with X-Forwarded-* header detection
- Credentials stored in `~/.aisbf/claude_credentials.json` - Credentials stored in `~/.aisbf/claude_credentials.json`
- Optional curl_cffi TLS fingerprinting for Cloudflare bypass - Optional curl_cffi TLS fingerprinting for Cloudflare bypass
- Compatible with official claude-cli credentials - Compatible with official claude-cli credentials
......
This diff is collapsed.
...@@ -14,7 +14,8 @@ const DEFAULT_CONFIG = { ...@@ -14,7 +14,8 @@ const DEFAULT_CONFIG = {
enabled: true, enabled: true,
remoteServer: '', // Will be set from AISBF dashboard remoteServer: '', // Will be set from AISBF dashboard
ports: [54545], // Default OAuth callback ports to intercept ports: [54545], // Default OAuth callback ports to intercept
paths: ['/callback', '/oauth/callback', '/auth/callback'] paths: ['/callback', '/oauth/callback', '/auth/callback'],
forceInterception: false // Override for OAuth flows initiated from AISBF
}; };
// Current configuration // Current configuration
...@@ -76,11 +77,16 @@ function generateRules() { ...@@ -76,11 +77,16 @@ function generateRules() {
// If the remote server is on localhost, we don't need to intercept // If the remote server is on localhost, we don't need to intercept
// The OAuth2 callback can go directly to localhost without redirection // The OAuth2 callback can go directly to localhost without redirection
if (isRemoteLocal) { // EXCEPTION: If we have an ongoing OAuth flow initiated from AISBF (forceInterception flag)
if (isRemoteLocal && !config.forceInterception) {
console.log('[AISBF] Remote server is localhost - no interception needed'); console.log('[AISBF] Remote server is localhost - no interception needed');
return rules; return rules;
} }
if (isRemoteLocal && config.forceInterception) {
console.log('[AISBF] Remote server is localhost but force interception is enabled for active OAuth flow');
}
for (const port of config.ports) { for (const port of config.ports) {
for (const path of config.paths) { for (const path of config.paths) {
// Rule for 127.0.0.1 // Rule for 127.0.0.1
...@@ -217,7 +223,8 @@ chrome.runtime.onMessageExternal.addListener((message, sender, sendResponse) => ...@@ -217,7 +223,8 @@ chrome.runtime.onMessageExternal.addListener((message, sender, sendResponse) =>
enabled: true, enabled: true,
remoteServer: message.remoteServer || sender.url.replace(/\/dashboard.*$/, ''), remoteServer: message.remoteServer || sender.url.replace(/\/dashboard.*$/, ''),
ports: message.ports || config.ports, ports: message.ports || config.ports,
paths: message.paths || config.paths paths: message.paths || config.paths,
forceInterception: message.forceInterception || false
}; };
saveConfig(newConfig).then(success => { saveConfig(newConfig).then(success => {
sendResponse({ success, config: newConfig }); sendResponse({ success, config: newConfig });
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment