1 | import { Manager, AdapterConfiguration } from "@fusion.io/core";
|
2 | import { IdentityProvider } from "./Contracts";
|
3 | import Gateway from "./Gateway";
|
4 | /**
|
5 | * The user friendly configuration for authenticator
|
6 | */
|
7 | export declare type AuthenticatorConfiguration = {
|
8 | default: string;
|
9 | gateways: {
|
10 | [name: string]: {
|
11 | protocol: "string";
|
12 | options: any;
|
13 | };
|
14 | };
|
15 | };
|
16 | export declare type GatewayConnector = (options?: any) => IdentityProvider | IdentityProvider[];
|
17 | /**
|
18 | * An authenticator service. It its simplest form, it managing
|
19 | * gateways
|
20 | *
|
21 | */
|
22 | export declare class Authenticator extends Manager<Gateway> {
|
23 | private gatewayConnectors;
|
24 | /**
|
25 | * Connect an IDP to the gateway
|
26 | *
|
27 | * @param gateway
|
28 | * @param connector
|
29 | */
|
30 | connect(gateway: string, connector: GatewayConnector): this;
|
31 | /**
|
32 | *
|
33 | * @param config
|
34 | */
|
35 | bootstrap(config: AuthenticatorConfiguration): this;
|
36 | /**
|
37 | * Overrides the install adapter method to connect the gateway with IDP
|
38 | *
|
39 | * @param configuration
|
40 | */
|
41 | protected installAdapter(configuration: AdapterConfiguration): Gateway;
|
42 | /**
|
43 | * Authenticate a context by a given gateway
|
44 | *
|
45 | * @param gateway
|
46 | * @param context
|
47 | */
|
48 | authenticate(gateway: string, context: Object): Promise<any>;
|
49 | /**
|
50 | * Returning a connection which can be used to mount to
|
51 | * the transport layer
|
52 | *
|
53 | * Normally, we need to authenticate over Http, then guard() will
|
54 | * return a middleware
|
55 | *
|
56 | * If we authenticate over Socket, then guard() will return the
|
57 | * socket connection middleware
|
58 | *
|
59 | * @param gateway
|
60 | * @return {mount}
|
61 | */
|
62 | guard(gateway: string): (...arg: any[]) => any;
|
63 | }
|