refactor(api-token): drop passport, rename to ApiToken

We don't need a library that requires as much boilerplate code as
writing the AuthGuard ourselves, especially since the token validation
was already custom code by us.

The previous name PublicAuthToken was a bit misleading, since PublicAuth
 could also be interpreted as being used for the public frontend in
contrast to the API. The old name before that (AuthToken) wasn't better
since it wasn't clear what type of auth is meant. I know, this is the
second renaming of the same module in less than a month. However, I
would say the name ApiToken seems rather reasonable and understandable.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2024-09-13 17:09:01 +02:00 committed by Philip Molares
parent 1c73e99b0a
commit 2c6717e1ee
33 changed files with 424 additions and 614 deletions

View file

@ -5,6 +5,7 @@
*/
import { Module } from '@nestjs/common';
import { ApiTokenModule } from '../../api-token/api-token.module';
import { FrontendConfigModule } from '../../frontend-config/frontend-config.module';
import { GroupsModule } from '../../groups/groups.module';
import { HistoryModule } from '../../history/history.module';
@ -13,7 +14,6 @@ import { LoggerModule } from '../../logger/logger.module';
import { MediaModule } from '../../media/media.module';
import { NotesModule } from '../../notes/notes.module';
import { PermissionsModule } from '../../permissions/permissions.module';
import { PublicAuthTokenModule } from '../../public-auth-token/public-auth-token.module';
import { RevisionsModule } from '../../revisions/revisions.module';
import { UsersModule } from '../../users/users.module';
import { AliasController } from './alias/alias.controller';
@ -27,14 +27,14 @@ import { HistoryController } from './me/history/history.controller';
import { MeController } from './me/me.controller';
import { MediaController } from './media/media.controller';
import { NotesController } from './notes/notes.controller';
import { PublicAuthTokensController } from './tokens/publicAuthTokensController';
import { ApiTokensController } from './tokens/api-tokens.controller';
import { UsersController } from './users/users.controller';
@Module({
imports: [
LoggerModule,
UsersModule,
PublicAuthTokenModule,
ApiTokenModule,
FrontendConfigModule,
HistoryModule,
PermissionsModule,
@ -45,7 +45,7 @@ import { UsersController } from './users/users.controller';
GroupsModule,
],
controllers: [
PublicAuthTokensController,
ApiTokensController,
ConfigController,
MediaController,
HistoryController,