import { CloudCodeRequest } from './CloudCodeRequest'; import { CloudCodeResponse } from './CloudCodeResponse'; import { InternalTaskContext } from './InternalTaskContext'; import { TaskContext } from './TaskContext'; export declare enum IdpTaskType { auth = 0, user = 1 } /** * Helper methods for enum. */ export declare namespace IdpTaskType { function parse(taskType: string): IdpTaskType; } export interface IdpResponse { } export declare class IdpExtractIdentityResponse implements IdpResponse { readonly authorized: boolean; readonly user: any | null; readonly error: any | null; /** * Response to identity provider attempt. * @param authorized * @param result of identity extraction as a user or error object */ protected constructor(authorized: boolean, result: any); static success(user: any): IdpExtractIdentityResponse; static error(error: any): IdpExtractIdentityResponse; } export declare class IdpProcessClaimsResponse implements IdpResponse { readonly success: boolean; readonly title: string | null; readonly message: string | null; readonly redirect: string | null; protected constructor(success: boolean, title: string, message: string, redirect: string); static success(title: string, message: string): IdpProcessClaimsResponse; static error(title: string, message: string): IdpProcessClaimsResponse; static redirect(url: string): IdpProcessClaimsResponse; } declare type ExtractIdentityFunction = (this: TaskContext, context: ExtractIdentityParams) => Promise; declare type ProcessClaimsFunction = (this: TaskContext, context: ProcessClaimsParams) => Promise; declare type WorkerFunction = ExtractIdentityFunction | ProcessClaimsFunction; export declare class IdpContext { readonly bundleIdentifier: string; readonly deviceIdentifier: string; constructor(bundleIdentifier: string, deviceIdentifier: string); authorized(user: any): IdpExtractIdentityResponse; unauthorized(error: { message: string; }): IdpExtractIdentityResponse; } export declare class IdpUserContext { readonly bundleIdentifier: string; readonly deviceIdentifier: string; constructor(bundleIdentifier: string, deviceIdentifier: string); success(result: { title: string; message: string; }): IdpProcessClaimsResponse; error(error: { title: string; message: string; }): IdpProcessClaimsResponse; redirect(url: string): IdpProcessClaimsResponse; } export interface ExtractIdentityParams { claims: any; context: IdpContext; } export interface ProcessClaimsParams { claims: any; context: IdpUserContext; custom: string; } export declare class IdentityProviderProcessor { static forModule(taskModule: any, taskType: IdpTaskType): IdentityProviderProcessor; private readonly taskType; private readonly workerFunction; protected constructor(taskType: IdpTaskType, workerFunction: WorkerFunction); handleRequest(taskContext: InternalTaskContext, request: CloudCodeRequest): Promise; } export {};