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}`
},
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/")) {
return `v2/${tokenUuid}/${hmac}`;
};
-const clusterLogin = async (clusterId: string, baseUrl: string, activeSession: Session): Promise<{user: User, token: string}> => {
+const clusterLogin = async (clusterId: string, baseUrl: string, activeSession: Session): Promise<{ user: User, token: string }> => {
const tokenUuid = await getTokenUuid(activeSession.baseUrl, activeSession.token);
const saltedToken = getSaltedToken(clusterId, tokenUuid, activeSession.token);
const user = await getUserDetails(baseUrl, saltedToken);
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);
export const loadSiteManagerPanel = () =>
async (dispatch: Dispatch<any>) => {
try {
- dispatch(setBreadcrumbs([{ label: 'Site Manager'}]));
+ dispatch(setBreadcrumbs([{ label: 'Site Manager' }]));
dispatch(validateSessions());
} catch (e) {
return;