UNPKG

@jbrowse/plugin-authentication

Version:

JBrowse 2 Authentication

183 lines (182 loc) 6.71 kB
import type { OAuthInternetAccountConfigModel } from './configSchema'; import type { UriLocation } from '@jbrowse/core/util'; import type { Instance } from 'mobx-state-tree'; declare const stateModelFactory: (configSchema: OAuthInternetAccountConfigModel) => import("mobx-state-tree").IModelType<{ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>; type: import("mobx-state-tree").ISimpleType<string>; configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{ name: { description: string; type: string; defaultValue: string; }; description: { description: string; type: string; defaultValue: string; }; authHeader: { description: string; type: string; defaultValue: string; }; tokenType: { description: string; type: string; defaultValue: string; }; domains: { description: string; type: string; defaultValue: never[]; }; }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>; } & { type: import("mobx-state-tree").ISimpleType<"OAuthInternetAccount">; configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{ tokenType: { description: string; type: string; defaultValue: string; }; authEndpoint: { description: string; type: string; defaultValue: string; }; tokenEndpoint: { description: string; type: string; defaultValue: string; }; needsPKCE: { description: string; type: string; defaultValue: boolean; }; clientId: { description: string; type: string; defaultValue: string; }; scopes: { description: string; type: string; defaultValue: string; }; state: { description: string; type: string; defaultValue: string; }; responseType: { description: string; type: string; defaultValue: string; }; }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{ name: { description: string; type: string; defaultValue: string; }; description: { description: string; type: string; defaultValue: string; }; authHeader: { description: string; type: string; defaultValue: string; }; tokenType: { description: string; type: string; defaultValue: string; }; domains: { description: string; type: string; defaultValue: never[]; }; }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>; }, { readonly name: string; readonly description: string; readonly internetAccountId: string; readonly authHeader: string; readonly tokenType: string; readonly domains: string[]; readonly toggleContents: React.ReactNode; readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined; readonly selectorLabel: string | undefined; } & { handlesLocation(location: UriLocation): boolean; readonly tokenKey: string; } & { getTokenFromUser(_resolve: (token: string) => void, _reject: (error: Error) => void): void; storeToken(token: string): void; removeToken(): void; retrieveToken(): string | null; validateToken(token: string, _loc: UriLocation): Promise<string>; } & { getToken(location?: UriLocation): Promise<string>; } & { addAuthHeaderToInit(init?: RequestInit, token?: string): { headers: Headers; body?: BodyInit | null; cache?: RequestCache; credentials?: RequestCredentials; integrity?: string; keepalive?: boolean; method?: string; mode?: RequestMode; priority?: RequestPriority; redirect?: RequestRedirect; referrer?: string; referrerPolicy?: ReferrerPolicy; signal?: AbortSignal | null; window?: null; }; getPreAuthorizationInformation(location: UriLocation): Promise<{ internetAccountType: string; authInfo: { token: string; configuration: any; }; }>; } & { getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>; } & { openLocation(location: UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache; } & { readonly codeVerifierPKCE: string; } & { readonly authEndpoint: string; readonly tokenEndpoint: string; readonly needsPKCE: boolean; readonly clientId: string; readonly scopes: string; state(): string | undefined; readonly responseType: "token" | "code"; readonly refreshTokenKey: string; } & { storeRefreshToken(refreshToken: string): void; removeRefreshToken(): void; retrieveRefreshToken(): string | null; exchangeAuthorizationForAccessToken(token: string, redirectUri: string): Promise<string>; exchangeRefreshForAccessToken(refreshToken: string): Promise<string>; } & { addMessageChannel(resolve: (token: string) => void, reject: (error: Error) => void): void; deleteMessageChannel(): void; finishOAuthWindow(event: MessageEvent, resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>; useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>; getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>; validateToken(token: string, location: UriLocation): Promise<string>; } & { getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>; }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>; export default stateModelFactory; export type OAuthStateModel = ReturnType<typeof stateModelFactory>; export type OAuthModel = Instance<OAuthStateModel>;