Documentation
¶
Index ¶
- func NewAuthorizerHandler(a HttpAuthorizer, wrapped http.Handler) http.Handler
- func NewAuthorizerStreamServerInterceptor(a GrpcAuthorizer) grpc.StreamServerInterceptor
- func NewAuthorizerUnaryServerInterceptor(a GrpcAuthorizer) grpc.UnaryServerInterceptor
- func NewGrpcAuthorizer(rule string, opts ...authorizerOption) (*grpcAuthorizer, error)
- func NewHttpAuthorizer(rule string, opts ...authorizerOption) (*httpAuthorizer, error)
- func WithTokenExtractor(te TokenExtractor, requireToken bool) authorizerOption
- type GrpcAuthorizer
- type HttpAuthorizer
- type TokenExtractor
- type TokenFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuthorizerHandler ¶
func NewAuthorizerHandler(a HttpAuthorizer, wrapped http.Handler) http.Handler
NewAuthorizerHandler returns an HTTP handler which evaluates the Authorizer policy as an http middleware If the policy check fails StatusForbidden is returned, otherwise the wrapped handler is executed
func NewAuthorizerStreamServerInterceptor ¶
func NewAuthorizerStreamServerInterceptor(a GrpcAuthorizer) grpc.StreamServerInterceptor
NewAuthorizerStreamServerInterceptor returns a StreamServerInterceptor which evaluates the Authorizer policy for each request If the policy check fails a PermissionDenied error code is returned, otherwise the request handler is executes as normal
func NewAuthorizerUnaryServerInterceptor ¶
func NewAuthorizerUnaryServerInterceptor(a GrpcAuthorizer) grpc.UnaryServerInterceptor
NewAuthorizerUnaryServerInterceptor returns a UnaryServerInterceptor which evaluates the Authorizer policy for each request If the policy check fails a PermissionDenied error code is returned, otherwise the request handler is executes as normal
func NewGrpcAuthorizer ¶
NewGrpcAuthorizer produces an Authorizer that can evaluate a CEL policy over Grpc requests The rule must evaluate to a bool
func NewHttpAuthorizer ¶
NewHttpAuthorizer produces an Authorizer that can evaluate a CEL policy over Grpc requests The rule must evaluate to a bool
func WithTokenExtractor ¶
func WithTokenExtractor(te TokenExtractor, requireToken bool) authorizerOption
WithTokenExtractor will populate the request.jwt field with the IDToken produced by the extractor If requireToken is set, the request will be denied if token extraction fails, without evaluating the policy If requireToken is false, JWT will be nil if token extraction fails and the policy will be evaluated
Types ¶
type GrpcAuthorizer ¶
type HttpAuthorizer ¶
type TokenExtractor ¶
type TokenFormat ¶
type TokenFormat int
const ( TokenFormatInvalid TokenFormat = iota TokenFormatNone TokenFormatJWT )
func ParseTokenFormat ¶
func ParseTokenFormat(input string) (TokenFormat, error)