Add auth interceptor

This commit is contained in:
2021-12-05 14:55:18 +01:00
parent 6377602033
commit 651de90839
10 changed files with 228 additions and 97 deletions

View File

@@ -18,6 +18,8 @@ import (
"gitea.benny.dog/torjus/ezshare/config"
"gitea.benny.dog/torjus/ezshare/pb"
"gitea.benny.dog/torjus/ezshare/server"
"gitea.benny.dog/torjus/ezshare/server/interceptors"
"gitea.benny.dog/torjus/ezshare/store"
"github.com/urfave/cli/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
@@ -211,6 +213,7 @@ func ActionServe(c *cli.Context) error {
grpcServer := grpc.NewServer(
grpc.Creds(creds),
grpc.ChainUnaryInterceptor(interceptors.NewAuthInterceptor(&store.MemoryStore{})),
)
pb.RegisterFileServiceServer(grpcServer, grpcFileServer)