Skip to content

Commit 377794b

Browse files
authored
Cleanup around clear token (#743)
1 parent d49ceaf commit 377794b

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/authentication/IAuthenticator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface IAuthenticator {
2828
/**
2929
* Clears access token from current session.
3030
*/
31-
clearAccessToken(cleanOnlyClient?: boolean): Promise<void>;
31+
clearAccessToken(cleanOnlyClient?: boolean): void;
3232

3333
/**
3434
* Checks if current user is signed in.

src/components/app/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class App {
3939
if (!token) {
4040
const managementApiAccessToken = settings["managementApiAccessToken"];
4141
if (!managementApiAccessToken) {
42-
await this.authenticator.clearAccessToken();
42+
this.authenticator.clearAccessToken();
4343
window.location.assign("/");
4444
return;
4545
}
@@ -49,7 +49,7 @@ export class App {
4949

5050
if (now >= accessToken.expires) {
5151
this.viewManager.addToast(startupError, `Management API access token has expired. See setting <i>managementApiAccessToken</i> in the configuration file <i>config.design.json</i>`);
52-
await this.authenticator.clearAccessToken();
52+
this.authenticator.clearAccessToken();
5353
return;
5454
}
5555

src/components/defaultAuthenticator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class DefaultAuthenticator implements IAuthenticator {
4242
});
4343
}
4444

45-
public async clearAccessToken(): Promise<void> {
45+
public clearAccessToken(): void {
4646
sessionStorage.removeItem("accessToken");
4747
}
4848

src/components/staticAuthenticator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class StaticAuthenticator implements IAuthenticator {
3232
return undefined;
3333
}
3434

35-
public async clearAccessToken(): Promise<void> {
35+
public clearAccessToken(): void {
3636
this.accessToken = undefined;
3737
}
3838

src/routing/signOutRouteGuard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class SignOutRouteGuard implements RouteGuard {
88

99
public async canActivate(route: Route): Promise<boolean> {
1010
if (route.hash === hashSignOut) {
11-
await this.authenticator.clearAccessToken();
11+
this.authenticator.clearAccessToken();
1212
location.assign(pageUrlHome);
1313
}
1414
return true;

src/services/usersService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class UsersService {
3636
return userId;
3737
}
3838
else {
39-
await this.authenticator.clearAccessToken(true);
39+
this.authenticator.clearAccessToken(true);
4040
return undefined;
4141
}
4242
}
@@ -93,8 +93,8 @@ export class UsersService {
9393
* Initiates signing-out with Basic identity provider.
9494
* @param withRedirect
9595
*/
96-
public async signOut(withRedirect: boolean = true): Promise<void> {
97-
await this.authenticator.clearAccessToken();
96+
public signOut(withRedirect: boolean = true): void {
97+
this.authenticator.clearAccessToken();
9898

9999
if (withRedirect) {
100100
this.navigateToSignin();
@@ -194,7 +194,7 @@ export class UsersService {
194194

195195
await this.mapiClient.delete<string>(query, [header]);
196196

197-
await this.signOut();
197+
this.signOut();
198198
}
199199
catch (error) {
200200
this.navigateToSignin();

0 commit comments

Comments
 (0)