@access-mcp/shared
Version:
Shared utilities for ACCESS-CI MCP servers
61 lines (60 loc) • 1.69 kB
TypeScript
/**
* Authentication provider for Drupal JSON:API using cookie-based auth.
*
* This is a temporary implementation for development/testing.
* Production should use Key Auth with the access_mcp_author module.
*
* @see ../../../access-qa-planning/06-mcp-authentication.md
*/
export declare class DrupalAuthProvider {
private baseUrl;
private username;
private password;
private sessionCookie?;
private csrfToken?;
private logoutToken?;
private userUuid?;
private httpClient;
private isAuthenticated;
constructor(baseUrl: string, username: string, password: string);
/**
* Ensure we have a valid session, logging in if necessary
*/
ensureAuthenticated(): Promise<void>;
/**
* Login to Drupal and store session cookie + CSRF token
*/
login(): Promise<void>;
/**
* Get headers required for authenticated JSON:API requests
*/
getAuthHeaders(): Record<string, string>;
/**
* Get the authenticated user's UUID
*/
getUserUuid(): string | undefined;
/**
* Invalidate the current session
*/
invalidate(): void;
/**
* Make an authenticated GET request to JSON:API
*/
get(path: string): Promise<any>;
/**
* Make an authenticated POST request to JSON:API
*/
post(path: string, data: any): Promise<any>;
/**
* Make an authenticated PATCH request to JSON:API
*/
patch(path: string, data: any): Promise<any>;
/**
* Make an authenticated DELETE request to JSON:API
*/
delete(path: string): Promise<any>;
/**
* Handle JSON:API response, throwing on errors
*/
private handleResponse;
}