GODT-1924: gRPC identity validation with tokens.

This commit is contained in:
Xavier Michelon
2022-10-05 20:26:28 +02:00
parent 1854256a93
commit 58ba3b012e
16 changed files with 1857 additions and 1252 deletions

View File

@ -29,6 +29,10 @@ import (
func (s *Service) RunEventStream(request *EventStreamRequest, server Bridge_RunEventStreamServer) error {
s.log.Debug("Starting Event stream")
if err := s.validateServerToken(server.Context()); err != nil {
return err
}
if s.eventStreamCh != nil {
return status.Errorf(codes.AlreadyExists, "the service is already streaming") // TO-DO GODT-1667 decide if we want to kill the existing stream.
}
@ -75,7 +79,11 @@ func (s *Service) RunEventStream(request *EventStreamRequest, server Bridge_RunE
}
// StopEventStream stops the event stream.
func (s *Service) StopEventStream(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
func (s *Service) StopEventStream(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
if err := s.validateServerToken(ctx); err != nil {
return nil, err
}
if s.eventStreamCh == nil {
return nil, status.Errorf(codes.NotFound, "The service is not streaming")
}