From 510a698bd3fa0bed5b34744a0625286efa07de29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Sterba?= <andre.sterba@stud.h-da.de>
Date: Thu, 2 Jun 2022 10:08:23 +0200
Subject: [PATCH] Fix controller build

---
 controller/controller.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/controller/controller.go b/controller/controller.go
index 931c38756..cb853c45d 100644
--- a/controller/controller.go
+++ b/controller/controller.go
@@ -106,7 +106,7 @@ func startGrpc() error {
 	log.Infof("listening to %v", lislisten.Addr())
 
 	jwtManager := rbacImpl.NewJWTManager(config.JWTSecret, config.JWTDuration)
-	setupGRPCServerWithCorrectSecurityLevel(jwtManager)
+	setupGRPCServerWithCorrectSecurityLevel(jwtManager, c.userService, c.roleService)
 
 	c.nbi = nbi.NewNBI(c.pndStore, c.userService, c.roleService, *jwtManager)
 
@@ -286,13 +286,13 @@ func callback(id uuid.UUID, ch chan device.Details) {
 // This allows users to operate on the controller without any authentication/authorization,
 // but they could still login if they want to.
 // Use insecure only for testing purposes and with caution.
-func setupGRPCServerWithCorrectSecurityLevel(jwt *rbacImpl.JWTManager) {
+func setupGRPCServerWithCorrectSecurityLevel(jwt *rbacImpl.JWTManager, userService rbac.UserService, roleService rbac.RoleService) {
 	securityLevel := viper.GetString("security")
 	if securityLevel == "insecure" {
 		c.grpcServer = grpc.NewServer()
 		log.Info("set up grpc server in insecure mode")
 	} else {
-		interceptor := server.NewAuthInterceptor(jwt)
+		interceptor := server.NewAuthInterceptor(jwt, userService, roleService)
 		c.grpcServer = grpc.NewServer(grpc.UnaryInterceptor(interceptor.Unary()), grpc.StreamInterceptor(interceptor.Stream()))
 		log.Info("set up grpc server in secure mode")
 	}
-- 
GitLab