@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
30 lines • 1.21 kB
TypeScript
/// <reference types="node" />
import * as http from 'http';
import { MaybePromise } from '../../common';
import { ElectronSecurityToken } from '../../electron-common/electron-token';
import { WsRequestValidatorContribution } from '../../node/ws-request-validators';
/**
* On Electron, we want to make sure that only Electron's browser-windows access the backend services.
*/
export declare class ElectronTokenValidator implements WsRequestValidatorContribution {
protected electronSecurityToken: ElectronSecurityToken;
protected postConstruct(): void;
allowWsUpgrade(request: http.IncomingMessage): MaybePromise<boolean>;
/**
* Expects the token to be passed via cookies by default.
*/
allowRequest(request: http.IncomingMessage): boolean;
/**
* Validates a token.
*
* This method both checks the shape of the parsed token data and its actual value.
*
* @param token Parsed object sent by the client as the token.
*/
isTokenValid(token: unknown): boolean;
/**
* Returns the token to compare to when authorizing requests.
*/
protected getToken(): ElectronSecurityToken;
}
//# sourceMappingURL=electron-token-validator.d.ts.map