proxy: Move CS3 User backend options to "functional" options

This will make it easier to add/remove options to the backend in the
future.
This commit is contained in:
Ralf Haferkamp
2023-03-20 15:12:09 +01:00
committed by Ralf Haferkamp
parent 88e8bb1b72
commit 490a835a3a
2 changed files with 73 additions and 19 deletions
+8 -1
View File
@@ -147,7 +147,14 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config)
Msg("Failed to create token manager")
}
userProvider = backend.NewCS3UserBackend(rolesClient, revaClient, cfg.MachineAuthAPIKey, cfg.OIDC.Issuer, tokenManager, logger)
userProvider = backend.NewCS3UserBackend(
backend.WithLogger(logger),
backend.WithRoleService(rolesClient),
backend.WithRevaAuthenticator(revaClient),
backend.WithMachineAuthAPIKey(cfg.MachineAuthAPIKey),
backend.WithOIDCissuer(cfg.OIDC.Issuer),
backend.WithTokenManager(tokenManager),
)
default:
logger.Fatal().Msgf("Invalid accounts backend type '%s'", cfg.AccountBackend)
}