[ARVADOS-WORKBENCH2] created: 2.1.0-249-g07086d1c

Git user git at public.arvados.org
Wed Mar 31 14:36:32 UTC 2021


        at  07086d1ce2f74956fd3a498f184fcc0274f3e38d (commit)


commit 07086d1ce2f74956fd3a498f184fcc0274f3e38d
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Mar 31 11:31:56 2021 -0300

    16159: Passes the token to be expire when calling the logout endpoint.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index 8d27b5bb..bd4bc196 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -103,9 +103,9 @@ export class AuthService {
         window.location.assign(`https://${homeClusterHost}/login?${(uuidPrefix !== homeCluster && homeCluster !== loginCluster) ? "remote=" + uuidPrefix + "&" : ""}return_to=${currentUrl}`);
     }
 
-    public logout() {
+    public logout(expireToken: string) {
         const currentUrl = `${window.location.protocol}//${window.location.host}`;
-        window.location.assign(`${this.baseUrl || ""}/logout?return_to=${currentUrl}`);
+        window.location.assign(`${this.baseUrl || ""}/logout?api_token=${expireToken}&return_to=${currentUrl}`);
     }
 
     public getUserDetails = (showErrors?: boolean): Promise<User> => {
diff --git a/src/store/auth/auth-middleware.test.ts b/src/store/auth/auth-middleware.test.ts
index bcc942e1..1438cab3 100644
--- a/src/store/auth/auth-middleware.test.ts
+++ b/src/store/auth/auth-middleware.test.ts
@@ -38,7 +38,7 @@ describe("AuthMiddleware", () => {
         const middleware = authMiddleware(services)(store)(next);
         middleware(authActions.LOGOUT({deleteLinkData: false}));
         expect(window.location.assign).toBeCalledWith(
-            `/logout?return_to=${location.protocol}//${location.host}`
+            `/logout?api_token=someToken&return_to=${location.protocol}//${location.host}`
         );
         expect(localStorage.getItem(API_TOKEN_KEY)).toBeFalsy();
     });
diff --git a/src/store/auth/auth-middleware.ts b/src/store/auth/auth-middleware.ts
index 6eef5e5e..ce7cd5cb 100644
--- a/src/store/auth/auth-middleware.ts
+++ b/src/store/auth/auth-middleware.ts
@@ -64,11 +64,12 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
             if (deleteLinkData) {
                 services.linkAccountService.removeAccountToLink();
             }
+            const token = services.authService.getApiToken();
             services.authService.removeApiToken();
             services.authService.removeSessions();
             services.authService.removeUser();
             removeAuthorizationHeader(services);
-            services.authService.logout();
+            services.authService.logout(token || '');
         },
         default: () => next(action)
     });

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list