packages/core: reorder some AuthConnector methods
This commit is contained in:
+4
-4
@@ -94,6 +94,10 @@ export class DefaultAuthConnector<AuthSession>
|
||||
this.sessionTransform = sessionTransform;
|
||||
}
|
||||
|
||||
async createSession(scopes: Set<string>): Promise<AuthSession> {
|
||||
return this.authRequester(scopes);
|
||||
}
|
||||
|
||||
async refreshSession(): Promise<any> {
|
||||
const res = await fetch(this.buildUrl('/token', { optional: true }), {
|
||||
headers: {
|
||||
@@ -138,10 +142,6 @@ export class DefaultAuthConnector<AuthSession>
|
||||
}
|
||||
}
|
||||
|
||||
async createSession(scopes: Set<string>): Promise<AuthSession> {
|
||||
return this.authRequester(scopes);
|
||||
}
|
||||
|
||||
private async showPopup(scope: string): Promise<AuthSession> {
|
||||
const popupUrl = this.buildUrl('/start', { scope });
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ const defaultMockSession: MockSession = {
|
||||
export class MockAuthConnector implements AuthConnector<MockSession> {
|
||||
constructor(private readonly mockSession: MockSession = defaultMockSession) {}
|
||||
|
||||
async createSession() {
|
||||
return this.mockSession;
|
||||
}
|
||||
|
||||
async refreshSession() {
|
||||
return this.mockSession;
|
||||
}
|
||||
|
||||
async removeSession() {}
|
||||
|
||||
async createSession() {
|
||||
return this.mockSession;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export type BaseAuthSession = {
|
||||
* by for example communicating with a backend or interacting with the user.
|
||||
*/
|
||||
export type AuthConnector<AuthSession> = {
|
||||
createSession(scopes: Set<string>): Promise<AuthSession>;
|
||||
refreshSession(): Promise<AuthSession>;
|
||||
removeSession(): Promise<void>;
|
||||
createSession(scopes: Set<string>): Promise<AuthSession>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user