Temporary: extended live logging
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
ref lfk/frontend#28
This commit is contained in:
parent
80197d5834
commit
154c763719
@ -19,6 +19,7 @@ const authchecker = async (action: Action, permissions: string[] | string) => {
|
|||||||
} else {
|
} else {
|
||||||
required_permissions = permissions
|
required_permissions = permissions
|
||||||
}
|
}
|
||||||
|
console.log(required_permissions);
|
||||||
|
|
||||||
let jwtPayload = undefined
|
let jwtPayload = undefined
|
||||||
try {
|
try {
|
||||||
@ -26,6 +27,7 @@ const authchecker = async (action: Action, permissions: string[] | string) => {
|
|||||||
jwtPayload = <any>jwt.verify(provided_token, config.jwt_secret);
|
jwtPayload = <any>jwt.verify(provided_token, config.jwt_secret);
|
||||||
jwtPayload = jwtPayload["userdetails"];
|
jwtPayload = jwtPayload["userdetails"];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(action.request.headers["authorization"]);
|
||||||
jwtPayload = await refresh(action);
|
jwtPayload = await refresh(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ const authchecker = async (action: Action, permissions: string[] | string) => {
|
|||||||
for (let required_permission of required_permissions) {
|
for (let required_permission of required_permissions) {
|
||||||
if (!(jwtPayload["permissions"].includes(required_permission))) { return false; }
|
if (!(jwtPayload["permissions"].includes(required_permission))) { return false; }
|
||||||
}
|
}
|
||||||
|
console.log("success");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +55,9 @@ const refresh = async (action: Action) => {
|
|||||||
refresh_token = cookie.parse(action.request.headers["cookie"])["lfk_backend__refresh_token"];
|
refresh_token = cookie.parse(action.request.headers["cookie"])["lfk_backend__refresh_token"];
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
console.log(action.request.headers["cookie"])
|
||||||
|
console.log("cookie fail here")
|
||||||
|
console.log(cookie.parse(action.request.headers["cookie"]))
|
||||||
throw new IllegalJWTError();
|
throw new IllegalJWTError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +65,8 @@ const refresh = async (action: Action) => {
|
|||||||
try {
|
try {
|
||||||
jwtPayload = <any>jwt.verify(refresh_token, config.jwt_secret);
|
jwtPayload = <any>jwt.verify(refresh_token, config.jwt_secret);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(refresh_token);
|
||||||
|
console.log("jwt fail")
|
||||||
throw new IllegalJWTError();
|
throw new IllegalJWTError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user