Documentation ¶
Index ¶
- Constants
- func ContextLoggerStreamServerInterceptor() grpc.StreamServerInterceptor
- func ContextLoggerUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func DefaultHeaderMatcher(key string) (string, bool)
- func GetAuthToken(ctx context.Context) (token string)
- func GetClientIP(ctx context.Context) string
- func GetHeader(ctx context.Context, key string) string
- func LogRequestStreamServerInterceptor() grpc.StreamServerInterceptor
- func LogRequestUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func RegisterJsonCodec()
- func SetZeroLogger()
- func ValidatorStreamServerInterceptor() grpc.StreamServerInterceptor
- func ValidatorUnaryClientInterceptor() grpc.UnaryClientInterceptor
- func ValidatorUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func WithAuthToken(token string) grpc.CallOption
- type AccessController
- type TokenAuth
Constants ¶
const AllowedHeaderPrefix = "x-"
const (
// JsonCodecName is the name registered for the json encoder.
JsonCodecName = "json"
)
Variables ¶
This section is empty.
Functions ¶
func ContextLoggerStreamServerInterceptor ¶
func ContextLoggerStreamServerInterceptor() grpc.StreamServerInterceptor
func ContextLoggerUnaryServerInterceptor ¶
func ContextLoggerUnaryServerInterceptor() grpc.UnaryServerInterceptor
func DefaultHeaderMatcher ¶
DefaultHeaderMatcher allows header with "x-" prefix
func GetAuthToken ¶
func GetClientIP ¶
GetClientIP gets client IP from HTTP forward header or GRPC context
func LogRequestStreamServerInterceptor ¶
func LogRequestStreamServerInterceptor() grpc.StreamServerInterceptor
func LogRequestUnaryServerInterceptor ¶
func LogRequestUnaryServerInterceptor() grpc.UnaryServerInterceptor
func RegisterJsonCodec ¶
func RegisterJsonCodec()
func SetZeroLogger ¶
func SetZeroLogger()
func ValidatorStreamServerInterceptor ¶
func ValidatorStreamServerInterceptor() grpc.StreamServerInterceptor
ValidatorStreamServerInterceptor returns a new streaming server interceptor that validates incoming messages.
The stage at which invalid messages will be rejected with `InvalidArgument` varies based on the type of the RPC. For `ServerStream` (1:m) requests, it will happen before reaching any userspace handlers. For `ClientStream` (n:1) or `BidiStream` (n:m) RPCs, the messages will be rejected on calls to `stream.Recv()`.
func ValidatorUnaryClientInterceptor ¶
func ValidatorUnaryClientInterceptor() grpc.UnaryClientInterceptor
ValidatorUnaryClientInterceptor returns a new unary client interceptor that validates outgoing messages.
Invalid messages will be rejected with `InvalidArgument` before sending the request to server.
func ValidatorUnaryServerInterceptor ¶
func ValidatorUnaryServerInterceptor() grpc.UnaryServerInterceptor
ValidatorUnaryServerInterceptor returns a new unary server interceptor that validates incoming messages.
Invalid messages will be rejected with `InvalidArgument` before reaching any userspace handlers.
func WithAuthToken ¶
func WithAuthToken(token string) grpc.CallOption
Types ¶
type AccessController ¶
type AccessController struct {
// contains filtered or unexported fields
}
func NewAccessController ¶
func NewAccessController(modelFile string, policyFile string) (*AccessController, error)
func (*AccessController) StreamServerInterceptor ¶
func (c *AccessController) StreamServerInterceptor() grpc.StreamServerInterceptor
func (*AccessController) UnaryServerInterceptor ¶
func (c *AccessController) UnaryServerInterceptor() grpc.UnaryServerInterceptor
type TokenAuth ¶
type TokenAuth struct {
// contains filtered or unexported fields
}