auth: Add maximum token lifetime of 2 years.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-25 12:14:26 +01:00 committed by David Mehren
parent 6686fa58c5
commit ad0ab648bc
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
5 changed files with 24 additions and 27 deletions

View file

@ -45,14 +45,17 @@ export class AuthToken {
public static create(
user: User,
identifier: string,
label: string,
keyId: string,
accessToken: string,
validUntil: Date,
): Pick<AuthToken, 'user' | 'accessToken'> {
): Pick<
AuthToken,
'user' | 'label' | 'keyId' | 'accessTokenHash' | 'createdAt' | 'validUntil'
> {
const newToken = new AuthToken();
newToken.user = user;
newToken.label = identifier;
newToken.label = label;
newToken.keyId = keyId;
newToken.accessTokenHash = accessToken;
newToken.createdAt = new Date();