Documentation ¶
Index ¶
- func ExtractCookie(lines []string, name string) *string
- func GetCookieValue(line, desired string) *string
- func ProcessMetdata(auth *oauth.Authenticator, ctx context.Context) (context.Context, error)
- func StreamInterceptor(auth *oauth.Authenticator, unauthenticated ...string) grpc.StreamServerInterceptor
- func UnaryInterceptor(auth *oauth.Authenticator, unauthenticated ...string) grpc.UnaryServerInterceptor
- type ContextStream
- type GrpcInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractCookie ¶
ExtractCookie returns the value of the first cookie by the specified name.
lines is a list of cookie header lines, as extracted from the HTTP or gRPC request. name is the name of a cookie.
The value of the cookie is returned, or nil if no cookie by the specified name was found.
func GetCookieValue ¶
GetCookieValue extracts the value of a cookie, formatted as per HTTP standard.
This function does not implement the full HTTP standard, just enough to extract the cookie value for validation.
func ProcessMetdata ¶
ProcessMetadata extracts the grpc metadata from a grpc provided context.Context, and verifies that the request was effectively authenticated.
There is no authorization at this layer, just sets the credentials of the user.
func StreamInterceptor ¶
func StreamInterceptor(auth *oauth.Authenticator, unauthenticated ...string) grpc.StreamServerInterceptor
func UnaryInterceptor ¶
func UnaryInterceptor(auth *oauth.Authenticator, unauthenticated ...string) grpc.UnaryServerInterceptor
Types ¶
type ContextStream ¶
type ContextStream struct { grpc.ServerStream // contains filtered or unexported fields }
ContextStream is a grpc.ServerStream with a different context attached.
This is necessary as grpc.ServerStream has no mechanism to change the context attached with the stream. So, we replace the stream instead.
func SetContextStream ¶
func SetContextStream(stream grpc.ServerStream, ctx context.Context) *ContextStream
func (*ContextStream) Context ¶
func (c *ContextStream) Context() context.Context
type GrpcInterceptor ¶
type GrpcInterceptor func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error