backend-app-api: pass dependencies

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2024-03-27 10:33:02 +01:00
parent 7231bc2a71
commit e8fd082f3b
@@ -109,7 +109,6 @@ class DefaultAuthService implements AuthService {
private readonly userTokenHandler: UserTokenHandler,
private readonly pluginId: string,
private readonly disableDefaultAuthPolicy: boolean,
private readonly databaseService: DatabaseService,
private readonly pluginTokenHandler: PluginTokenHandler,
) {}
@@ -235,7 +234,6 @@ class DefaultAuthService implements AuthService {
export const authServiceFactory = createServiceFactory({
service: coreServices.auth,
deps: {
database: coreServices.database,
config: coreServices.rootConfig,
logger: coreServices.rootLogger,
discovery: coreServices.discovery,
@@ -245,8 +243,16 @@ export const authServiceFactory = createServiceFactory({
// keeps working as long as there are plugins that have not been migrated to the
// new auth services in the new backend system.
tokenManager: coreServices.tokenManager,
publicKeyStore: coreServices.publicKeyStore,
},
async factory({ config, discovery, plugin, tokenManager, database }) {
async factory({
config,
discovery,
plugin,
tokenManager,
logger,
publicKeyStore,
}) {
const disableDefaultAuthPolicy = Boolean(
config.getOptionalBoolean(
'backend.auth.dangerouslyDisableDefaultAuthPolicy',
@@ -257,9 +263,12 @@ export const authServiceFactory = createServiceFactory({
new UserTokenHandler({ discovery }),
plugin.getId(),
disableDefaultAuthPolicy,
database,
// TODO(vinzscam): fixme
PluginTokenHandler.create(undefined!),
PluginTokenHandler.create({
keyDurationSeconds: 60 * 60,
issuer: `plugin:${plugin.getId()}`,
logger,
publicKeyStore,
}),
);
},
});