///
///
import { AnyObject } from '@loopback/repository';
import { Request } from '@loopback/express';
import * as SamlStrategy from '@node-saml/passport-saml';
import * as AppleStrategy from 'passport-apple';
import { DecodedIdToken } from 'passport-apple';
import * as AzureADStrategy from 'passport-azure-ad';
import * as FacebookStrategy from 'passport-facebook';
import * as GoogleStrategy from 'passport-google-oauth20';
import * as InstagramStrategy from 'passport-instagram';
import * as Auth0Strategy from 'passport-auth0';
import { Auth0, Cognito, IAuthClient, IAuthSecureClient, IAuthUser } from '../../types';
import { Keycloak } from './keycloak.types';
import { Otp } from '../passport/passport-otp';
export type VerifyCallback = (err?: string | Error | null, user?: Express.User, info?: AnyObject) => void;
export declare namespace VerifyFunction {
interface OauthClientPasswordFn extends GenericAuthFn {
(clientId: string, clientSecret: string, req?: Request): Promise;
}
interface OauthSecureClientPasswordFn extends GenericAuthFn {
(clientId: string, clientSecret: string, req?: Request): Promise;
}
interface LocalPasswordFn extends GenericAuthFn {
(username: string, password: string, req?: Request): Promise;
}
interface OtpAuthFn extends GenericAuthFn {
(key: string, otp: string, cb: Otp.VerifyCallback): Promise;
}
interface BearerFn extends GenericAuthFn {
(token: string, req?: Request): Promise;
}
type ResourceOwnerPasswordFn = (clientId: string, clientSecret: string, username: string, password: string, req?: Request) => Promise<{
client: T;
user: S;
} | null>;
type SecureResourceOwnerPasswordFn = (clientId: string, clientSecret: string, username: string, password: string, req?: Request) => Promise<{
client: T;
user: S;
} | null>;
interface GoogleAuthFn extends GenericAuthFn {
(accessToken: string, refreshToken: string, profile: GoogleStrategy.Profile, cb: GoogleStrategy.VerifyCallback, req?: Request): Promise;
}
interface AzureADAuthFn extends GenericAuthFn {
(accessToken: string, refreshToken: string, profile: AzureADStrategy.IProfile, done: AzureADStrategy.VerifyCallback, req?: Request): Promise;
}
interface KeycloakAuthFn extends GenericAuthFn {
(accessToken: string, refreshToken: string, profile: Keycloak.Profile, cb: (err?: string | Error, user?: IAuthUser) => void): Promise;
}
interface InstagramAuthFn extends VerifyFunction.GenericAuthFn {
(accessToken: string, refreshToken: string, profile: InstagramStrategy.Profile, cb: VerifyCallback, req?: Request): Promise;
}
interface FacebookAuthFn extends VerifyFunction.GenericAuthFn {
(accessToken: string, refreshToken: string, profile: FacebookStrategy.Profile, cb: VerifyCallback, req?: Request): Promise;
}
interface CognitoAuthFn extends GenericAuthFn {
(accessToken: string, refreshToken: string, profile: Cognito.Profile, cb: Cognito.VerifyCallback, req?: Request): Promise;
}
interface Auth0Fn extends GenericAuthFn {
(accessToken: string, refreshToken: string, profile: Auth0Strategy.Profile, cb: Auth0.VerifyCallback, req?: Request): Promise;
}
interface AppleAuthFn extends GenericAuthFn {
(accessToken: string, refreshToken: string, decodedIdToken: DecodedIdToken, profile: AppleStrategy.Profile, cb: AppleStrategy.VerifyCallback, req?: Request): Promise;
}
interface SamlFn extends GenericAuthFn {
(profile: SamlStrategy.Profile, cb: SamlStrategy.VerifiedCallback, req?: Request): Promise;
}
type GenericAuthFn = (...params: any) => Promise;
}