tftsr-devops_investigation/src-tauri/src/integrations/mod.rs
Shaun Arman c885f2cc8f
Some checks failed
Test / frontend-tests (push) Waiting to run
Test / wiki-sync (push) Waiting to run
Test / rust-tests (push) Waiting to run
Test / frontend-typecheck (push) Waiting to run
Auto Tag / auto-tag (push) Successful in 4s
Test / rust-fmt-check (push) Failing after 2m12s
Test / rust-clippy (push) Has been cancelled
Release / build-windows-amd64 (push) Has been cancelled
Release / build-macos-arm64 (push) Has been cancelled
Release / build-linux-arm64 (push) Has been cancelled
Release / build-linux-amd64 (push) Has been cancelled
feat: add multi-mode authentication for integrations (v0.2.10)
Implement three authentication methods for Confluence, ServiceNow, and Azure DevOps:

1. **OAuth2** - Traditional OAuth flow for enterprise SSO environments
2. **Embedded Browser** - Webview-based login that captures session cookies/tokens
   - Solves VPN constraints: users authenticate off-VPN via web UI
   - Extracted credentials work on-VPN for API calls
   - Based on confluence-publisher agent pattern
3. **Manual Token** - Direct API token/PAT input as fallback

**Changes:**
- Add webview_auth.rs module for embedded browser authentication
- Implement authenticate_with_webview and extract_cookies_from_webview commands
- Implement save_manual_token command with validation
- Add AuthMethod enum to support all three modes
- Add RadioGroup UI component for mode selection
- Complete rewrite of Integrations settings page with mode-specific UI
- Add secondary button variant for UI consistency

**VPN-friendly design:**
Users can authenticate via webview when off-VPN (web UI accessible), then use extracted cookies for API calls when on-VPN (API requires VPN). Addresses enterprise SSO limitations where OAuth app registration is blocked.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-03 17:26:09 -05:00

48 lines
1.0 KiB
Rust

pub mod auth;
pub mod azuredevops;
pub mod callback_server;
pub mod confluence;
pub mod servicenow;
pub mod webview_auth;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConnectionResult {
pub success: bool,
pub message: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PublishResult {
pub url: String,
pub id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TicketResult {
pub id: String,
pub ticket_number: String,
pub url: String,
}
/// Authentication method for integration services
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "method")]
pub enum AuthMethod {
#[serde(rename = "oauth2")]
OAuth2 {
access_token: String,
expires_at: Option<i64>,
},
#[serde(rename = "cookies")]
Cookies {
cookies: Vec<webview_auth::Cookie>,
},
#[serde(rename = "token")]
Token {
token: String,
token_type: String, // "Bearer", "Basic", etc.
},
}