Added dummy auth example

This commit is contained in:
sm
2018-01-24 21:52:33 -08:00
parent f61632af7f
commit bea25aa0d1
4 changed files with 52 additions and 3 deletions
+6 -1
View File
@@ -17,8 +17,13 @@ func (s *Server) Hello(ctx context.Context, req *pb.HelloReq) (*pb.HelloResp, er
return nil, twirp.RequiredArgumentError("subject")
}
u, err := getUser(ctx)
if err != nil {
return nil, twirp.InternalErrorWith(err)
}
r := &pb.HelloResp{
Text: fmt.Sprintf("echo: %v", req.Subject),
Text: fmt.Sprintf("%s said: %v", u, req.Subject),
Hostname: s.Hostname,
}
return r, nil