basic RefreshAuth checking

ref #12
This commit is contained in:
Philipp Dormann 2020-12-05 13:07:33 +01:00
parent 82f31185a1
commit 126799dab9

View File

@ -20,12 +20,7 @@ export class RefreshAuth {
} catch (error) { } catch (error) {
throw new IllegalJWTError() throw new IllegalJWTError()
} }
const found_user = found_users[0] console.log(decoded["userid"]);
delete found_user.password;
newAuth.access_token = "ja"
newAuth.access_token_expires_at = 5555555
newAuth.refresh_token = "ja"
newAuth.refresh_token_expires_at = 555555
const found_user = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] }); const found_user = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] });
if (!found_user) { if (!found_user) {
throw new UserNotFoundError() throw new UserNotFoundError()
@ -33,6 +28,13 @@ export class RefreshAuth {
if (found_user.refreshTokenCount !== decoded["refreshtokencount"]) { if (found_user.refreshTokenCount !== decoded["refreshtokencount"]) {
throw new RefreshTokenCountInvalidError() throw new RefreshTokenCountInvalidError()
} }
console.log(found_user);
// delete found_user.password;
newAuth.access_token = "ja"
newAuth.access_token_expires_at = 5555555
newAuth.refresh_token = "ja"
newAuth.refresh_token_expires_at = 555555
return newAuth; return newAuth;
} }
} }