Skip to content

Commit

Permalink
Add stub for auth echo service.
Browse files Browse the repository at this point in the history
This will provide back to clients at least the contents of the
Authorization header, so they can verify that tokens were transmitted
appropriately.
  • Loading branch information
westarle committed Oct 7, 2024
1 parent 8a91e64 commit da5c1ef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions schema/google/showcase/v1beta1/echo.proto
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ service Echo {
body: "*"
};
};

// This method returns authentication details from the incoming request, including things like
// Authorization headers for clients to verify that the correct headers are being sent.
rpc EchoAuthentication(EchoAuthenticationRequest) returns (EchoAuthenticationResponse) {
option (google.api.http) = {
post: "/v1beta1/echo:authentication"
body: "*"
}
};
}

// A severity enum used to test enum capabilities in GAPIC surfaces.
Expand Down Expand Up @@ -390,3 +399,14 @@ message BlockResponse {
// here.
string content = 1;
}

// The request for EchoAuthentication method. This is currently empty but
// is included as a unique message (not Empty) in case we need to add to it
// later.
message EchoAuthenticationRequest {
}

// The response for the EchoAuthentication method.
message EchoAuthenticationResponse {
repeated string headers = 1;
}
4 changes: 4 additions & 0 deletions server/services/echo_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ func (s *echoServerImpl) Chat(stream pb.Echo_ChatServer) error {
}
}

func (s *echoServerImpl) EchoAuthentication(ctx context.Context, in *pb.EchoAuthenticationRequest) (*pb.EchoAuthenticationResponse, error) {
// Stuff the Authorization header from the context into the response.
}

func (s *echoServerImpl) PagedExpandLegacy(ctx context.Context, in *pb.PagedExpandLegacyRequest) (*pb.PagedExpandResponse, error) {
req := &pb.PagedExpandRequest{
Content: in.Content,
Expand Down

0 comments on commit da5c1ef

Please sign in to comment.