UNPKG

1.88 kBTypeScriptView Raw
1/**
2 * @license
3 * MOST Web Framework 2.0 Codename Blueshift
4 * Copyright (c) 2017, THEMOST LP All rights reserved
5 *
6 * Use of this source code is governed by an BSD-3-Clause license that can be
7 * found in the LICENSE file at https://themost.io/license
8 */
9import {
10 HttpApplicationService,
11 PreExecuteResultHandler,
12 AuthenticateRequestHandler,
13 PreExecuteResultArgs
14} from "../types";
15import {HttpContext} from "../context";
16
17export declare abstract class AuthStrategy extends HttpApplicationService {
18
19 abstract setAuthCookie(thisContext: HttpContext, userName: string, options: any);
20
21 abstract getAuthCookie(thisContext: HttpContext): any;
22
23 abstract login(thisContext: HttpContext, userName: string, userPassword: string);
24
25 abstract logout(thisContext: HttpContext);
26
27 abstract getUnattendedExecutionAccount(): string;
28
29 abstract getOptions(): any;
30}
31
32export declare class DefaultAuthStrategy extends AuthStrategy {
33
34 getAuthCookie(thisContext: HttpContext): any;
35
36 getOptions(): any;
37
38 getUnattendedExecutionAccount(): string;
39
40 login(thisContext: HttpContext, userName: string, userPassword: string);
41
42 logout(thisContext: HttpContext);
43
44 setAuthCookie(thisContext: HttpContext, userName: string, options: any);
45
46}
47
48export declare abstract class EncryptionStrategy extends HttpApplicationService {
49 abstract encrypt(data: any);
50 abstract decrypt(data: string);
51}
52
53export declare class DefaultEncryptionStrategy extends EncryptionStrategy {
54 encrypt(data: any);
55 decrypt(data: string);
56}
57
58export declare class AuthHandler implements AuthenticateRequestHandler, PreExecuteResultHandler {
59
60 authenticateRequest(context: HttpContext, callback: (err?: Error) => void);
61
62 preExecuteResult(args: PreExecuteResultArgs, callback: (err?: Error) => void);
63
64}
65
66export declare function createInstance(): AuthHandler;
\No newline at end of file