From 6a937655ab404e01f88293cdf9b5f4d2e8aab347 Mon Sep 17 00:00:00 2001 From: Anna Shumilova Date: Mon, 22 Jul 2019 14:33:17 +0300 Subject: [PATCH] Store github token in session storage, remove on logout Signed-off-by: Anna Shumilova --- dashboard/src/components/api/che-keycloak.factory.ts | 3 ++- dashboard/src/components/github/github-service.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dashboard/src/components/api/che-keycloak.factory.ts b/dashboard/src/components/api/che-keycloak.factory.ts index 68f190b2d02..4d94353444b 100644 --- a/dashboard/src/components/api/che-keycloak.factory.ts +++ b/dashboard/src/components/api/che-keycloak.factory.ts @@ -68,7 +68,8 @@ export class CheKeycloak { } logout(): void { - window.sessionStorage.setItem('oidcDashboardRedirectUrl', location.href); + window.sessionStorage.removeItem('githubToken'); + window.sessionStorage.setItem('oidcDashboardRedirectUrl', location.href); this.keycloak.logout({}); } diff --git a/dashboard/src/components/github/github-service.ts b/dashboard/src/components/github/github-service.ts index e40329d04c2..6e3a8d57d0c 100644 --- a/dashboard/src/components/github/github-service.ts +++ b/dashboard/src/components/github/github-service.ts @@ -124,10 +124,10 @@ export class GitHubService { .factory('gitHubTokenStore', function () { return { setToken: function (token: string) { - localStorage.setItem('gitHubToken', token); // jshint ignore:line + sessionStorage.githubToken = token; }, getToken: function () { - return localStorage.getItem('gitHubToken'); // jshint ignore:line + return sessionStorage.githubToken; } }; }).factory('gitHubApiUtils', ['gitHubApiUrlRoot', function (gitHubApiUrlRoot: string) {