auth

package
v2.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsInternalUser

func AsInternalUser(ctx context.Context, username string) context.Context

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.

func ClearWhoAmI

func ClearWhoAmI(ctx context.Context) context.Context

TODO: Unused. Remove?

func GetWhoAmI

func GetWhoAmI(ctx context.Context) string

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) SetHeader

func (s ServerStreamWrapper) SetHeader(md metadata.MD) error

func (ServerStreamWrapper) SetTrailer

func (s ServerStreamWrapper) SetTrailer(md metadata.MD)

Directories

Path Synopsis
Package httpauth extracts auth information from an HTTP request.
Package httpauth extracts auth information from an HTTP request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL