auth: Integrate suggestions by @davidmehren

Add number type alias TimestampMillis
Remove solved ToDos
Change AuthToken and AuthTokenDto to use Date
Rename authService unit tests

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-23 21:24:11 +01:00 committed by David Mehren
parent e6dc8c7678
commit a8b46923fd
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
7 changed files with 149 additions and 93 deletions

View file

@ -17,6 +17,7 @@ import { ConsoleLoggerService } from '../../../logger/console-logger.service';
import { AuthTokenDto } from '../../../auth/auth-token.dto';
import { AuthTokenWithSecretDto } from '../../../auth/auth-token-with-secret.dto';
import { AuthService } from '../../../auth/auth.service';
import { TimestampMillis } from '../../../utils/timestamp';
@Controller('tokens')
export class TokensController {
@ -38,10 +39,10 @@ export class TokensController {
@Post()
async postTokenRequest(
@Body('label') label: string,
@Body('until') until: number,
@Body('validUntil') validUntil: TimestampMillis,
): Promise<AuthTokenWithSecretDto> {
// ToDo: Get real userName
return this.authService.createTokenForUser('hardcoded', label, until);
return this.authService.createTokenForUser('hardcoded', label, validUntil);
}
@Delete('/:keyId')