Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
chore(backend): align strategy typings with AbstractStrategy
johavenb02669cdc5b5
diff --git a/backend/src/applications/files/guards/files-only-office.strategy.ts b/backend/src/applications/files/guards/files-only-office.strategy.tsindex 6b0c8fc0..a4a15cf5 100644--- a/backend/src/applications/files/guards/files-only-office.strategy.ts+++ b/backend/src/applications/files/guards/files-only-office.strategy.ts@@ -5,7 +5,7 @@*/import { Injectable } from '@nestjs/common'-import { PassportStrategy } from '@nestjs/passport'+import { AbstractStrategy, PassportStrategy } from '@nestjs/passport'import { PinoLogger } from 'nestjs-pino'import { ExtractJwt, Strategy } from 'passport-jwt'import { AuthTokenAccessStrategy } from '../../../authentication/guards/auth-token-access.strategy'@@ -15,7 +15,7 @@ import { UserModel } from '../../users/models/user.model'import { ONLY_OFFICE_TOKEN_QUERY_PARAM_NAME } from '../constants/only-office'@Injectable()-export class FilesOnlyOfficeStrategy extends PassportStrategy(Strategy, 'filesOnlyOfficeToken') {+export class FilesOnlyOfficeStrategy extends PassportStrategy(Strategy, 'filesOnlyOfficeToken') implements AbstractStrategy {constructor(private readonly logger: PinoLogger) {super({jwtFromRequest: ExtractJwt.fromExtractors([@@ -28,7 +28,6 @@ export class FilesOnlyOfficeStrategy extends PassportStrategy(Strategy, 'filesOn})}- // not declared properly: https://github.com/nestjs/passport/issues/929validate(jwtPayload: JwtPayload): UserModel {this.logger.assign({ user: jwtPayload.identity.login })return new UserModel(jwtPayload.identity)diff --git a/backend/src/applications/users/models/user.model.ts b/backend/src/applications/users/models/user.model.tsindex b0635c63..11f219a1 100644--- a/backend/src/applications/users/models/user.model.ts+++ b/backend/src/applications/users/models/user.model.ts@@ -47,7 +47,7 @@ export class UserModel implements User {fullName: stringimpersonated?: booleanavatarBase64?: string- // permissions as list+ // permissions as a listapplications: string[] = []private _homePath: stringprivate _filesPath: stringdiff --git a/backend/src/authentication/guards/auth-basic.strategy.ts b/backend/src/authentication/guards/auth-basic.strategy.tsindex 96e1e448..e4a7d4a8 100644--- a/backend/src/authentication/guards/auth-basic.strategy.ts+++ b/backend/src/authentication/guards/auth-basic.strategy.ts@@ -5,7 +5,7 @@*/import { Injectable } from '@nestjs/common'-import { PassportStrategy } from '@nestjs/passport'+import { AbstractStrategy, PassportStrategy } from '@nestjs/passport'import { instanceToPlain, plainToInstance } from 'class-transformer'import { FastifyRequest } from 'fastify'import { PinoLogger } from 'nestjs-pino'@@ -16,7 +16,7 @@ import { Cache } from '../../infrastructure/cache/services/cache.service'import { AuthMethod } from '../models/auth-method'@Injectable()-export class AuthBasicStrategy extends PassportStrategy(BasicStrategy, 'basic') {+export class AuthBasicStrategy extends PassportStrategy(BasicStrategy, 'basic') implements AbstractStrategy {static readonly CACHE_TTL = 900constructor(diff --git a/backend/src/authentication/guards/auth-local.strategy.ts b/backend/src/authentication/guards/auth-local.strategy.tsindex d19aa56e..fe24aaab 100755--- a/backend/src/authentication/guards/auth-local.strategy.ts+++ b/backend/src/authentication/guards/auth-local.strategy.ts@@ -5,7 +5,7 @@*/import { Injectable, UnauthorizedException } from '@nestjs/common'-import { PassportStrategy } from '@nestjs/passport'+import { PassportStrategy, AbstractStrategy } from '@nestjs/passport'import type { FastifyRequest } from 'fastify'import { PinoLogger } from 'nestjs-pino'import { Strategy } from 'passport-local'@@ -13,7 +13,7 @@ import type { UserModel } from '../../applications/users/models/user.model'import { AuthMethod } from '../models/auth-method'@Injectable()-export class AuthLocalStrategy extends PassportStrategy(Strategy, 'local') implements Strategy {+export class AuthLocalStrategy extends PassportStrategy(Strategy, 'local') implements AbstractStrategy {constructor(private readonly authMethod: AuthMethod,private readonly logger: PinoLogger@@ -21,7 +21,6 @@ export class AuthLocalStrategy extends PassportStrategy(Strategy, 'local') implesuper({ usernameField: 'login', passwordField: 'password', passReqToCallback: true })}- // not declared properly: https://github.com/nestjs/passport/issues/929async validate(req: FastifyRequest, loginOrEmail: string, password: string): Promise<UserModel> {this.logger.assign({ user: loginOrEmail })const user: UserModel = await this.authMethod.validateUser(loginOrEmail, password, req.ip)diff --git a/backend/src/authentication/guards/auth-token-access.strategy.ts b/backend/src/authentication/guards/auth-token-access.strategy.tsindex c53ca4bf..b039eb36 100755--- a/backend/src/authentication/guards/auth-token-access.strategy.ts+++ b/backend/src/authentication/guards/auth-token-access.strategy.ts@@ -5,7 +5,7 @@*/import { Injectable } from '@nestjs/common'-import { PassportStrategy } from '@nestjs/passport'+import { AbstractStrategy, PassportStrategy } from '@nestjs/passport'import { FastifyRequest } from 'fastify'import { PinoLogger } from 'nestjs-pino'import { ExtractJwt, Strategy } from 'passport-jwt'@@ -15,7 +15,7 @@ import { TOKEN_TYPE } from '../interfaces/token.interface'import { AuthManager } from '../services/auth-manager.service'@Injectable()-export class AuthTokenAccessStrategy extends PassportStrategy(Strategy, 'tokenAccess') {+export class AuthTokenAccessStrategy extends PassportStrategy(Strategy, 'tokenAccess') implements AbstractStrategy {private static accessCookieName: stringconstructor(@@ -31,7 +31,6 @@ export class AuthTokenAccessStrategy extends PassportStrategy(Strategy, 'tokenAcAuthTokenAccessStrategy.accessCookieName = authManager.authConfig.token.access.name}- // not declared properly: https://github.com/nestjs/passport/issues/929validate(req: FastifyRequest, jwtPayload: JwtPayload): UserModel {this.logger.assign({ user: jwtPayload.identity.login })this.authManager.csrfValidation(req, jwtPayload, TOKEN_TYPE.ACCESS)diff --git a/backend/src/authentication/guards/auth-token-refresh.strategy.ts b/backend/src/authentication/guards/auth-token-refresh.strategy.tsindex 5a774fbb..16a2c8d9 100755--- a/backend/src/authentication/guards/auth-token-refresh.strategy.ts+++ b/backend/src/authentication/guards/auth-token-refresh.strategy.ts@@ -5,7 +5,7 @@*/import { Injectable } from '@nestjs/common'-import { PassportStrategy } from '@nestjs/passport'+import { AbstractStrategy, PassportStrategy } from '@nestjs/passport'import { FastifyRequest } from 'fastify'import { PinoLogger } from 'nestjs-pino'import { ExtractJwt, Strategy } from 'passport-jwt'@@ -15,7 +15,7 @@ import { TOKEN_TYPE } from '../interfaces/token.interface'import { AuthManager } from '../services/auth-manager.service'@Injectable()-export class AuthTokenRefreshStrategy extends PassportStrategy(Strategy, 'tokenRefresh') {+export class AuthTokenRefreshStrategy extends PassportStrategy(Strategy, 'tokenRefresh') implements AbstractStrategy {private static refreshCookieName: stringconstructor(@@ -31,7 +31,6 @@ export class AuthTokenRefreshStrategy extends PassportStrategy(Strategy, 'tokenRAuthTokenRefreshStrategy.refreshCookieName = authManager.authConfig.token.refresh.name}- // not declared properly: https://github.com/nestjs/passport/issues/929validate(req: FastifyRequest, jwtPayload: JwtPayload): UserModel {this.logger.assign({ user: jwtPayload.identity.login })this.authManager.csrfValidation(req, jwtPayload, TOKEN_TYPE.REFRESH)