MCPcopy Create free account
hub / github.com/PaperDebugger/paperdebugger / grpcUnaryAuthInterceptor

Method grpcUnaryAuthInterceptor

internal/api/grpc.go:48–65  ·  view source on GitHub ↗
(
	ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
)

Source from the content-addressed store, hash-verified

46}
47
48func (s *GrpcServer) grpcUnaryAuthInterceptor(
49 ctx context.Context,
50 req interface{},
51 info *grpc.UnaryServerInfo,
52 handler grpc.UnaryHandler,
53) (interface{}, error) {
54 if strings.HasPrefix(info.FullMethod, "/auth.v1.AuthService/LoginBy") ||
55 strings.HasPrefix(info.FullMethod, "/auth.v1.AuthService/RefreshToken") {
56 return handler(ctx, req)
57 }
58
59 actor, err := s.authUserActor(ctx)
60 if err != nil {
61 return nil, err
62 }
63
64 return handler(contextutil.SetActor(ctx, actor), req)
65}
66
67func (s *GrpcServer) grpcStreamAuthInterceptor(
68 srv interface{},

Callers

nothing calls this directly

Calls 2

authUserActorMethod · 0.95
SetActorFunction · 0.92

Tested by

no test coverage detected