-
-
Notifications
You must be signed in to change notification settings - Fork 435
/
Copy pathauthentication-service.ts
41 lines (37 loc) · 1.28 KB
/
authentication-service.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { JsonRpcServer } from '@theia/core/lib/common/messaging/proxy-factory';
export const authServerPort = 9876;
export interface AuthOptions {
redirectUri: string;
responseType: string;
clientID: string;
domain: string;
audience: string;
registerUri: string;
scopes: string[];
}
export interface AuthenticationSession {
readonly id: string;
readonly accessToken: string;
readonly account: AuthenticationSessionAccountInformation;
readonly scopes: ReadonlyArray<string>;
}
export interface AuthenticationSessionAccountInformation {
readonly id: string;
readonly email: string;
readonly label: string;
readonly picture: string;
}
export const AuthenticationServicePath = '/services/authentication-service';
export const AuthenticationService = Symbol('AuthenticationService');
export interface AuthenticationService
extends JsonRpcServer<AuthenticationServiceClient> {
login(): Promise<AuthenticationSession>;
logout(): Promise<void>;
session(): Promise<AuthenticationSession | undefined>;
disposeClient(client: AuthenticationServiceClient): void;
setOptions(authOptions: AuthOptions): Promise<void>;
initAuthSession(): Promise<void>;
}
export interface AuthenticationServiceClient {
notifySessionDidChange(session?: AuthenticationSession | undefined): void;
}