refactor(server): auth guard (#1472)

* refactor: auth guard

* chore: move auth guard to middleware

* chore: tests

* chore: remove unused code

* fix: migration to uuid without dataloss

* chore: e2e tests

* chore: removed unused guards
This commit is contained in:
Jason Rasmussen
2023-01-31 13:11:49 -05:00
committed by GitHub
parent 68af4cd5ba
commit d2a9363fc5
40 changed files with 331 additions and 505 deletions

View File

@@ -1,4 +1,5 @@
import {
APIKeyEntity,
AssetType,
SharedLinkEntity,
SharedLinkType,
@@ -148,6 +149,16 @@ export const userTokenEntityStub = {
}),
};
export const keyStub = {
admin: Object.freeze({
id: 1,
name: 'My Key',
key: 'my-api-key (hashed)',
userId: authStub.admin.id,
user: userEntityStub.admin,
} as APIKeyEntity),
};
export const systemConfigStub = {
defaults: Object.freeze({
ffmpeg: {
@@ -275,6 +286,7 @@ export const sharedLinkStub = {
valid: Object.freeze({
id: '123',
userId: authStub.admin.id,
user: userEntityStub.admin,
key: Buffer.from('secret-key', 'utf8'),
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),
@@ -288,6 +300,7 @@ export const sharedLinkStub = {
expired: Object.freeze({
id: '123',
userId: authStub.admin.id,
user: userEntityStub.admin,
key: Buffer.from('secret-key', 'utf8'),
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),
@@ -300,6 +313,7 @@ export const sharedLinkStub = {
readonly: Object.freeze<SharedLinkEntity>({
id: '123',
userId: authStub.admin.id,
user: userEntityStub.admin,
key: Buffer.from('secret-key', 'utf8'),
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),