(
srv interface{},
ss grpc.ServerStream,
info *grpc.StreamServerInfo,
handler grpc.StreamHandler,
)
| 65 | } |
| 66 | |
| 67 | func (s *GrpcServer) grpcStreamAuthInterceptor( |
| 68 | srv interface{}, |
| 69 | ss grpc.ServerStream, |
| 70 | info *grpc.StreamServerInfo, |
| 71 | handler grpc.StreamHandler, |
| 72 | ) error { |
| 73 | if strings.HasPrefix(info.FullMethod, "/auth.v1.AuthService/LoginBy") || |
| 74 | strings.HasPrefix(info.FullMethod, "/auth.v1.AuthService/RefreshToken") { |
| 75 | return handler(srv, ss) |
| 76 | } |
| 77 | |
| 78 | actor, err := s.authUserActor(ss.Context()) |
| 79 | if err != nil { |
| 80 | return err |
| 81 | } |
| 82 | ctx := contextutil.SetActor(ss.Context(), actor) |
| 83 | |
| 84 | wrapped := WrapServerStream(ss) |
| 85 | wrapped.WrappedContext = ctx |
| 86 | |
| 87 | return handler(srv, wrapped) |
| 88 | } |
| 89 | |
| 90 | func (s *GrpcServer) authUserActor(ctx context.Context) (*accesscontrol.Actor, error) { |
| 91 | md, ok := metadata.FromIncomingContext(ctx) |
nothing calls this directly
no test coverage detected