mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 13:34:28 -04:00
tokens: Add token creation
Fix token deletion Update plantuml docs Add token validUntil and lastUsed fields Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
28abc37e2c
commit
c96edb31a5
2 changed files with 20 additions and 5 deletions
|
@ -48,11 +48,8 @@ export class AuthToken {
|
||||||
identifier: string,
|
identifier: string,
|
||||||
keyId: string,
|
keyId: string,
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
validUntil?: Date,
|
validUntil: Date,
|
||||||
): Pick<
|
): Pick<AuthToken, 'user' | 'accessToken'> {
|
||||||
AuthToken,
|
|
||||||
'user' | 'label' | 'keyId' | 'accessTokenHash' | 'createdAt' | 'validUntil'
|
|
||||||
> {
|
|
||||||
const newToken = new AuthToken();
|
const newToken = new AuthToken();
|
||||||
newToken.user = user;
|
newToken.user = user;
|
||||||
newToken.label = identifier;
|
newToken.label = identifier;
|
||||||
|
|
18
src/users/auth-token.dto.ts
Normal file
18
src/users/auth-token.dto.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { IsNumber, IsString } from 'class-validator';
|
||||||
|
|
||||||
|
export class AuthTokenDto {
|
||||||
|
@IsString()
|
||||||
|
label: string;
|
||||||
|
@IsNumber()
|
||||||
|
created: number;
|
||||||
|
@IsNumber()
|
||||||
|
validUntil: number | null;
|
||||||
|
@IsNumber()
|
||||||
|
lastUsed: number | null;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue