auth: Add cron to clean old tokens

Rename AuthToken.identifier to label

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-24 20:37:04 +01:00 committed by David Mehren
parent 14a4872f49
commit 8f008c7cc5
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
6 changed files with 27 additions and 17 deletions

View file

@ -25,7 +25,7 @@ export class AuthToken {
user: User;
@Column()
identifier: string;
label: string;
@CreateDateColumn()
createdAt: Date;
@ -51,16 +51,11 @@ export class AuthToken {
validUntil?: Date,
): Pick<
AuthToken,
| 'user'
| 'identifier'
| 'keyId'
| 'accessTokenHash'
| 'createdAt'
| 'validUntil'
'user' | 'label' | 'keyId' | 'accessTokenHash' | 'createdAt' | 'validUntil'
> {
const newToken = new AuthToken();
newToken.user = user;
newToken.identifier = identifier;
newToken.label = identifier;
newToken.keyId = keyId;
newToken.accessTokenHash = accessToken;
newToken.createdAt = new Date();