UNPKG

1.21 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as http from 'http';
3import { MaybePromise } from '../../common';
4import { ElectronSecurityToken } from '../../electron-common/electron-token';
5import { WsRequestValidatorContribution } from '../../node/ws-request-validators';
6/**
7 * On Electron, we want to make sure that only Electron's browser-windows access the backend services.
8 */
9export declare class ElectronTokenValidator implements WsRequestValidatorContribution {
10 protected electronSecurityToken: ElectronSecurityToken;
11 protected postConstruct(): void;
12 allowWsUpgrade(request: http.IncomingMessage): MaybePromise<boolean>;
13 /**
14 * Expects the token to be passed via cookies by default.
15 */
16 allowRequest(request: http.IncomingMessage): boolean;
17 /**
18 * Validates a token.
19 *
20 * This method both checks the shape of the parsed token data and its actual value.
21 *
22 * @param token Parsed object sent by the client as the token.
23 */
24 isTokenValid(token: unknown): boolean;
25 /**
26 * Returns the token to compare to when authorizing requests.
27 */
28 protected getToken(): ElectronSecurityToken;
29}
30//# sourceMappingURL=electron-token-validator.d.ts.map
\No newline at end of file