adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
111 lines • 2.87 kB
TypeScript
/**
* Confluence OAuth 2.0 (3LO) Authentication Handler
* Part of ADPA (Automated Document Processing Assistant) v2.1.3
*
* Handles OAuth 2.0 authentication flow for Confluence Cloud
* Features:
* - Authorization URL generation
* - Token exchange and refresh
* - Secure token storage
* - Automatic token refresh
*/
export interface OAuth2Config {
clientId: string;
clientSecret: string;
redirectUri: string;
scopes: string[];
baseUrl?: string;
}
export interface OAuth2Tokens {
access_token: string;
refresh_token: string;
expires_in: number;
token_type: string;
scope: string;
expires_at?: number;
}
export interface AccessibleResource {
id: string;
name: string;
url: string;
scopes: string[];
avatarUrl?: string;
}
/**
* OAuth 2.0 Authentication Handler for Confluence
*/
export declare class ConfluenceOAuth2 {
private config;
private tokens;
private tokenFilePath;
constructor(config: OAuth2Config);
/**
* Generate authorization URL for OAuth 2.0 flow
*/ getAuthorizationUrl(): string;
/**
* Start OAuth 2.0 authorization flow with local server
*/
startAuthorizationFlow(): Promise<OAuth2Tokens>;
/**
* Exchange authorization code for access tokens
*/
exchangeCodeForTokens(code: string): Promise<OAuth2Tokens>;
/**
* Get valid access token (refresh if needed)
*/
getValidAccessToken(): Promise<string>; /**
* Refresh access tokens using rotating refresh token
* Follows Atlassian's rotating refresh token implementation
*/
refreshTokens(): Promise<OAuth2Tokens>;
/**
* Get accessible Confluence resources
*/
getAccessibleResources(): Promise<AccessibleResource[]>;
/**
* Find Cloud ID for a specific site URL
*/
findCloudId(siteUrl: string): Promise<string | null>;
/**
* Check if currently authorized
*/
isAuthorized(): boolean;
/**
* Check if tokens are expired
*/
isTokenExpired(): boolean;
/**
* Get current token status
*/
getTokenStatus(): {
authorized: boolean;
expired: boolean;
expiresIn: number | null;
scopes: string[];
};
/**
* Revoke tokens and clear storage
*/
revokeAuthorization(): Promise<void>;
/**
* Load stored tokens from disk
*/
private loadStoredTokens;
/**
* Save tokens to disk
*/
private saveTokens;
/**
* Clear tokens from memory and disk
*/
private clearTokens;
/**
* Generate random state parameter for OAuth security
*/
private generateState;
}
/**
* Factory function to create OAuth 2.0 handler from environment variables
*/
export declare function createConfluenceOAuth2(): ConfluenceOAuth2;
//# sourceMappingURL=ConfluenceOAuth2.d.ts.map