mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -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
fd70b2d121
commit
599fe57ec6
9 changed files with 113 additions and 35 deletions
|
@ -30,9 +30,9 @@ export class TokensController {
|
|||
@Get()
|
||||
async getUserTokens(): Promise<AuthTokenDto[]> {
|
||||
// ToDo: Get real userName
|
||||
return (await this.usersService.getTokensByUsername('molly')).map((token) =>
|
||||
this.usersService.toAuthTokenDto(token),
|
||||
);
|
||||
return (
|
||||
await this.usersService.getTokensByUsername('hardcoded')
|
||||
).map((token) => this.usersService.toAuthTokenDto(token));
|
||||
}
|
||||
|
||||
@Post()
|
||||
|
@ -49,10 +49,10 @@ export class TokensController {
|
|||
return this.usersService.toAuthTokenWithSecretDto(authToken);
|
||||
}
|
||||
|
||||
@Delete('/:timestamp')
|
||||
@Delete('/:keyId')
|
||||
@HttpCode(204)
|
||||
async deleteToken(@Param('timestamp') timestamp: number) {
|
||||
async deleteToken(@Param('keyId') keyId: string) {
|
||||
// ToDo: Get real userName
|
||||
return this.usersService.removeToken('hardcoded', timestamp);
|
||||
return this.usersService.removeToken('hardcoded', keyId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue