Authenticating requests
In this section and the following, we are going to simplify the middleware that we currently have. First, we are going to start by simplifying the authentication process. We saw in the previous chapter that we can easily create an interceptor for checking an authentication token in headers. In this section, we are going to take a step further and make it even simpler.
Important note
gRPC supports retrying authentication of requests through an RBAC policy without a third-party library. However, the configuration is quite verbose and not very well documented. If you are interested in trying it, you can check the following example: https://github.com/grpc/grpc-go/blob/master/examples/features/authz/README.md.
Previously, when we wrote our interceptors, we needed to create the following function for a unary interceptor:
func unaryAuthInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler &...