auth: fixes unit and e2e tests

adds MockAuthGuard which always return user 'hardcoded'

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-16 19:33:09 +01:00 committed by David Mehren
parent 33d9c455b8
commit cce1626c48
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
4 changed files with 47 additions and 11 deletions

View file

@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { ExecutionContext, Injectable } from '@nestjs/common';
@Injectable()
export class MockAuthGuard {
canActivate(context: ExecutionContext) {
const req = context.switchToHttp().getRequest();
req.user = {
userName: 'hardcoded',
};
return true;
}
}