Skip to content

Commit

Permalink
Attempt to renew the token using existing credentials (only once), ot…
Browse files Browse the repository at this point in the history
…herwise change to status of the layer and wait for end-user to provide new credentials.

Removed debugging code.
  • Loading branch information
mdastous-bentley committed Jan 20, 2021
1 parent 405c18c commit 44cb714
Show file tree
Hide file tree
Showing 2 changed files with 882 additions and 861 deletions.
9 changes: 9 additions & 0 deletions core/frontend/src/tile/map/ArcGisTokenManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class ArcGisTokenManager {
private static _generator: ArcGisTokenGenerator | undefined;

public static async getToken(esriRestServiceUrl: string, options: ArcGisGenerateTokenOptions, saveSessionStorage: boolean = true): Promise<ArcGisToken | undefined> {

if (!ArcGisTokenManager._generator)
ArcGisTokenManager._generator = new ArcGisTokenGenerator();

Expand Down Expand Up @@ -50,4 +51,12 @@ export class ArcGisTokenManager {

return newToken;
}

public static invalidateToken(esriRestServiceUrl: string, userName: string): boolean {

const tokenCacheKey = `${userName}@${esriRestServiceUrl}`;
sessionStorage.removeItem(`arcgis:${tokenCacheKey}`)
return ArcGisTokenManager._cache.delete(tokenCacheKey);

}
}

0 comments on commit 44cb714

Please sign in to comment.