Documentation ¶
Index ¶
- func AsInternalUser(ctx context.Context, username string) context.Context
- func ClearWhoAmI(ctx context.Context) context.Context
- func GetWhoAmI(ctx context.Context) string
- type ContextKey
- type Interceptor
- type ServerStreamWrapper
- func (s ServerStreamWrapper) Context() context.Context
- func (s ServerStreamWrapper) RecvMsg(m interface{}) error
- func (s ServerStreamWrapper) SendHeader(md metadata.MD) error
- func (s ServerStreamWrapper) SendMsg(m interface{}) error
- func (s ServerStreamWrapper) SetHeader(md metadata.MD) error
- func (s ServerStreamWrapper) SetTrailer(md metadata.MD)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsInternalUser ¶
AsInternalUser should never be used during user requests, only internal background jobs. It gives a context a cached whoami username of form internal:<name>. It also overwrites any existing metadata. As a result, this context may not be able to make additional gRPCs.
Types ¶
type ContextKey ¶
type ContextKey string
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
Interceptor checks the authentication metadata in unary and streaming RPCs and prevents unknown or unauthorized calls.
func NewInterceptor ¶
func NewInterceptor(getAuthServer func() authserver.APIServer) *Interceptor
NewInterceptor instantiates a new Interceptor
func (*Interceptor) InterceptStream ¶
func (i *Interceptor) InterceptStream(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
InterceptStream applies authentication rules to streaming RPCs
func (*Interceptor) InterceptUnary ¶
func (i *Interceptor) InterceptUnary(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
InterceptUnary applies authentication rules to unary RPCs
type ServerStreamWrapper ¶
type ServerStreamWrapper struct {
// contains filtered or unexported fields
}
we use ServerStreamWrapper to set the stream's Context with added values
func (ServerStreamWrapper) Context ¶
func (s ServerStreamWrapper) Context() context.Context
func (ServerStreamWrapper) RecvMsg ¶
func (s ServerStreamWrapper) RecvMsg(m interface{}) error
func (ServerStreamWrapper) SendHeader ¶
func (s ServerStreamWrapper) SendHeader(md metadata.MD) error
func (ServerStreamWrapper) SendMsg ¶
func (s ServerStreamWrapper) SendMsg(m interface{}) error
func (ServerStreamWrapper) SetTrailer ¶
func (s ServerStreamWrapper) SetTrailer(md metadata.MD)
Click to show internal directories.
Click to hide internal directories.