/**
 * 統一認証設定クラス - auth.gftd.ai カスタムドメイン専用
 *
 * 全てのGFTDサービスでauth.gftd.aiドメインでの統一認証を実現
 * 各サービスではローカル認証コンポーネントを持たず、auth.gftd.aiにリダイレクト
 */
/**
 * 統一認証設定インターフェース
 */
export interface UnifiedAuthConfig {
    /** 統一認証ドメイン（固定: auth.gftd.ai） */
    authDomain: string;
    /** OAuth設定 */
    oauth: {
        clientId: string;
        clientSecret?: string;
        audience: string;
        scope: string;
    };
    /** リダイレクト設定 */
    redirects: {
        /** ログイン後のデフォルトリダイレクト先 */
        defaultPostLogin: string;
        /** ログアウト後のデフォルトリダイレクト先 */
        defaultPostLogout: string;
        /** 認証コールバックパス */
        callbackPath: string;
    };
    /** セッション設定 */
    session: {
        /** セッション暗号化キー */
        secretKey: string;
        /** セッション有効期限（秒） */
        maxAge: number;
        /** ローリングセッション */
        rolling: boolean;
        /** Cookie設定 */
        cookie: {
            name: string;
            secure: boolean;
            sameSite: 'strict' | 'lax' | 'none';
            domain?: string;
            path: string;
        };
        /** 🔐 *.gftd.ai 共通ログイン設定 */
        shared?: {
            /** 全サービス共通のCookie名 */
            enabled: boolean;
            /** 共通Cookieドメイン */
            cookieDomain: string;
            /** 共通Cookie名 */
            cookieName: string;
        };
    };
    /** サービス固有設定 */
    service: {
        /** サービス名 */
        name: string;
        /** サービスのベースURL */
        baseUrl: string;
        /** サービス固有のスコープ */
        additionalScopes?: string[];
    };
}
/**
 * 統一認証マネージャー
 *
 * auth.gftd.aiドメインでの統一認証フローを管理
 */
export declare class UnifiedAuthManager {
    private static instance;
    private config;
    private constructor();
    /**
     * シングルトンインスタンスを取得
     */
    static getInstance(config?: Partial<UnifiedAuthConfig>): UnifiedAuthManager;
    /**
     * サービス固有のセッション暗号化キーを取得
     *
     * 優先順位:
     * 1. 直接指定されたsecretKey
     * 2. サービス名ベースの環境変数 (GFTD_{SERVICE}_SESSION_SECRET)
     * 3. 統一環境変数 (GFTD_SESSION_SECRET, AUTH0_SECRET)
     */
    private getServiceSecretKey;
    /**
     * サービス固有のCookie名を取得
     */
    private getServiceCookieName;
    /**
     * サービスが *.gftd.ai ドメインかを判定
     */
    private isGftdDomainService;
    /**
     * 共通セッション設定を取得
     */
    private getSharedSessionConfig;
    /**
     * 設定の検証
     */
    private validateConfig;
    /**
     * 統一ログインURLを生成
     *
     * @param options ログインオプション
     * @returns auth.gftd.aiのログインURL
     */
    buildUnifiedLoginUrl(options?: {
        returnTo?: string;
        state?: string;
        connection?: string;
        prompt?: 'login' | 'consent' | 'select_account';
    }): string;
    /**
     * 統一ログアウトURLを生成
     *
     * @param options ログアウトオプション
     * @returns auth.gftd.aiのログアウトURL
     */
    buildUnifiedLogoutUrl(options?: {
        returnTo?: string;
        federated?: boolean;
        clearSharedSession?: boolean;
    }): string;
    /**
     * 認証コールバックURIを取得
     */
    getCallbackUri(): string;
    /**
     * 設定を取得
     */
    getConfig(): UnifiedAuthConfig;
    /**
     * サービス固有設定を更新
     */
    updateServiceConfig(serviceConfig: Partial<UnifiedAuthConfig['service']>): void;
    /**
     * 状態データを解析
     */
    parseStateData(encodedState: string): {
        returnTo?: string;
        service?: string;
        timestamp?: number;
        customState?: string;
    } | null;
    /**
     * セッションCookie名を取得
     */
    getSessionCookieName(): string;
    /**
     * セッション設定を取得
     */
    getSessionConfig(): UnifiedAuthConfig['session'];
}
/**
 * 統一認証マネージャーのインスタンスを取得するヘルパー関数
 */
export declare function getUnifiedAuthManager(config?: Partial<UnifiedAuthConfig>): UnifiedAuthManager;
/**
 * サービス向け統一認証設定のプリセット
 */
export declare const UnifiedAuthPresets: {
    /**
     * Webmaster (管理画面) 向け設定 - webmaster.gftd.ai
     */
    readonly webmaster: {
        readonly service: {
            readonly name: "GFTD Webmaster";
            readonly baseUrl: "https://webmaster.gftd.ai";
            readonly additionalScopes: readonly ["read:users", "update:users", "read:organizations"];
        };
        readonly redirects: {
            readonly defaultPostLogin: "/projects";
            readonly defaultPostLogout: "/auth/logout";
        };
        readonly session: {
            readonly shared: {
                readonly enabled: true;
            };
        };
    };
    /**
     * CLI向け設定 - cli.gftd.ai
     */
    readonly cli: {
        readonly service: {
            readonly name: "GFTD CLI";
            readonly baseUrl: "https://cli.gftd.ai";
            readonly additionalScopes: readonly ["read:projects", "write:projects"];
        };
        readonly redirects: {
            readonly defaultPostLogin: "/auth/success";
            readonly defaultPostLogout: "/auth/logout";
        };
        readonly session: {
            readonly shared: {
                readonly enabled: true;
            };
        };
    };
    /**
     * ORM向け設定 - orm.gftd.ai
     */
    readonly orm: {
        readonly service: {
            readonly name: "GFTD ORM";
            readonly baseUrl: "https://orm.gftd.ai";
            readonly additionalScopes: readonly ["read:data", "write:data"];
        };
        readonly redirects: {
            readonly defaultPostLogin: "/";
            readonly defaultPostLogout: "/";
        };
        readonly session: {
            readonly shared: {
                readonly enabled: true;
            };
        };
    };
    /**
     * 開発者向け設定
     */
    readonly development: {
        readonly session: {
            readonly cookie: {
                readonly secure: false;
            };
            readonly shared: {
                readonly enabled: false;
            };
        };
    };
};
/**
 * Express.js ミドルウェア: 統一認証リダイレクト
 */
export declare function unifiedAuthRedirectMiddleware(options?: {
    loginPath?: string;
    excludePaths?: string[];
    autoRedirect?: boolean;
}): (req: any, res: any, next: any) => any;
//# sourceMappingURL=unified-auth-config.d.ts.map