X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/989231578f1e66dbf0695007c31c250e4122f553..ccf093578f01b3d8ac0c421f85063939b3cd271d:/src/store/auth/auth-action-session.ts diff --git a/src/store/auth/auth-action-session.ts b/src/store/auth/auth-action-session.ts index d36d5a33..b889e9cf 100644 --- a/src/store/auth/auth-action-session.ts +++ b/src/store/auth/auth-action-session.ts @@ -56,7 +56,7 @@ const getTokenUuid = async (baseUrl: string, token: string): Promise => return Promise.resolve(uuid); } - const resp = await Axios.get(`${baseUrl}/api_client_authorizations`, { + const resp = await Axios.get(`${baseUrl}api_client_authorizations`, { headers: { Authorization: `OAuth2 ${token}` }, @@ -68,7 +68,7 @@ const getTokenUuid = async (baseUrl: string, token: string): Promise => return resp.data.items[0].uuid; }; -const getSaltedToken = (clusterId: string, tokenUuid: string, token: string) => { +export const getSaltedToken = (clusterId: string, tokenUuid: string, token: string) => { const shaObj = new jsSHA("SHA-1", "TEXT"); let secret = token; if (token.startsWith("v2/")) { @@ -92,14 +92,15 @@ const clusterLogin = async (clusterId: string, baseUrl: string, activeSession: S ownerUuid: user.owner_uuid, email: user.email, isAdmin: user.is_admin, - identityUrl: user.identity_url, + isActive: user.is_active, + username: user.username, prefs: user.prefs }, token: saltedToken }; }; -const getActiveSession = (sessions: Session[]): Session | undefined => sessions.find(s => s.active); +export const getActiveSession = (sessions: Session[]): Session | undefined => sessions.find(s => s.active); export const validateCluster = async (remoteHost: string, clusterId: string, activeSession: Session): Promise<{ user: User; token: string, baseUrl: string }> => { const baseUrl = await getRemoteHostBaseUrl(remoteHost);