[ARVADOS-WORKBENCH2] updated: 2.1.0-229-gab1faae9
Git user
git at public.arvados.org
Mon Mar 8 15:23:41 UTC 2021
Summary of changes:
src/store/auth/auth-action.ts | 17 +++++++++++++++--
src/views-components/token-dialog/token-dialog.tsx | 6 ++++--
2 files changed, 19 insertions(+), 4 deletions(-)
via ab1faae94143599e5537b40211d6b4370e0ecef6 (commit)
via 6b5e94cfb15a88d33aba5e7c192cfbe6aec9ac8d (commit)
from a51a9c10678118004ca3c4fb0af38c5c85d050eb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit ab1faae94143599e5537b40211d6b4370e0ecef6
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Mon Mar 8 12:22:06 2021 -0300
16848: Checks cached token validity before using it.
The cached token could be invalid or have its expiration date changed from an
API call outside Workbench2.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 2819364f..27558618 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -98,8 +98,21 @@ export const saveApiToken = (token: string) => async (dispatch: Dispatch, getSta
export const getNewExtraToken = (reuseStored: boolean = false) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- if (reuseStored && getState().auth.extraApiToken !== undefined) {
- return getState().auth.extraApiToken;
+ const extraToken = getState().auth.extraApiToken;
+ if (reuseStored && extraToken !== undefined) {
+ const config = dispatch<any>(getConfig);
+ const svc = createServices(config, { progressFn: () => { }, errorFn: () => { } });
+ setAuthorizationHeader(svc, extraToken);
+ try {
+ // Check the extra token's validity before using it. Refresh its
+ // expiration date just in case it changed.
+ const client = await svc.apiClientAuthorizationService.get('current');
+ dispatch(authActions.SET_EXTRA_TOKEN({
+ extraApiToken: extraToken,
+ extraApiTokenExpiration: client.expiresAt ? new Date(client.expiresAt): undefined,
+ }));
+ return extraToken;
+ } catch (e) { }
}
const user = getState().auth.user;
const loginCluster = getState().auth.config.clusterConfig.Login.LoginCluster;
commit 6b5e94cfb15a88d33aba5e7c192cfbe6aec9ac8d
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Fri Mar 5 12:32:27 2021 -0300
16848: Adds a legend for non-expiring tokens on the get token dialog.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/views-components/token-dialog/token-dialog.tsx b/src/views-components/token-dialog/token-dialog.tsx
index 60ef360c..ba3d1942 100644
--- a/src/views-components/token-dialog/token-dialog.tsx
+++ b/src/views-components/token-dialog/token-dialog.tsx
@@ -111,10 +111,12 @@ unset ARVADOS_API_HOST_INSECURE`
Paste the following lines at a shell prompt to set up the necessary environment for Arvados SDKs to authenticate to your account.
</Typography>
<DefaultCodeSnippet lines={[this.getSnippet(data)]} />
+ <Typography component='span'>
{ data.tokenExpiration
- ? <Typography component='span'>Expires at: {data.tokenExpiration.toLocaleString()}</Typography>
- : null
+ ? `Expires at: ${data.tokenExpiration.toLocaleString()}`
+ : `This token does not have an expiration date`
}
+ </Typography>
<CopyToClipboard text={this.getSnippet(data)} onCopy={() => this.onCopy('Token copied to clipboard')}>
<Button
color="primary"
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list