middleware

package
v1.17.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BEARER constanta
	BEARER = "BEARER"

	// BASIC constanta
	BASIC = "BASIC"

	// MULTIPLE constanta
	MULTIPLE = "MULTIPLE"
)
View Source
const (
	// DefaultCacheAge const
	DefaultCacheAge = 1 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

Middleware impl

func NewMiddleware

func NewMiddleware(tokenValidator interfaces.TokenValidator, aclPermissionChecker interfaces.ACLPermissionChecker) *Middleware

NewMiddleware create new middleware instance (DEPRECATED, use NewMiddlewareWithOption)

func NewMiddlewareWithOption added in v1.13.9

func NewMiddlewareWithOption(opts ...OptionFunc) *Middleware

NewMiddlewareWithOption create new middleware instance with option

func (*Middleware) Basic

func (m *Middleware) Basic(ctx context.Context, key string) error

Basic function basic auth

func (*Middleware) Bearer

func (m *Middleware) Bearer(ctx context.Context, tokenString string) (*candishared.TokenClaim, error)

Bearer token validator

func (*Middleware) GRPCBasicAuth

func (m *Middleware) GRPCBasicAuth(ctx context.Context) (context.Context, error)

GRPCBasicAuth method

func (*Middleware) GRPCBearerAuth

func (m *Middleware) GRPCBearerAuth(ctx context.Context) (context.Context, error)

GRPCBearerAuth method

func (*Middleware) GRPCMultipleAuth added in v1.14.6

func (m *Middleware) GRPCMultipleAuth(ctx context.Context) (context.Context, error)

GRPCMultipleAuth method

func (*Middleware) GRPCPermissionACL

func (m *Middleware) GRPCPermissionACL(permissionCode string) types.MiddlewareFunc

GRPCPermissionACL grpc interceptor for check acl permission

func (*Middleware) GraphQLAuth added in v1.12.0

func (m *Middleware) GraphQLAuth(ctx context.Context, directive *gqltypes.Directive, input interface{}) (context.Context, error)

GraphQLAuth for graphql resolver

func (*Middleware) GraphQLPermissionACL

func (m *Middleware) GraphQLPermissionACL(ctx context.Context, directive *gqltypes.Directive, input interface{}) (context.Context, error)

GraphQLPermissionACL graphql resolver for check acl permission

func (*Middleware) HTTPBasicAuth

func (m *Middleware) HTTPBasicAuth(next http.Handler) http.Handler

HTTPBasicAuth http basic auth middleware

func (*Middleware) HTTPBearerAuth

func (m *Middleware) HTTPBearerAuth(next http.Handler) http.Handler

HTTPBearerAuth http jwt token middleware

func (*Middleware) HTTPCache added in v1.14.6

func (m *Middleware) HTTPCache(next http.Handler) http.Handler

HTTPCache middleware for cache

func (*Middleware) HTTPMultipleAuth

func (m *Middleware) HTTPMultipleAuth(next http.Handler) http.Handler

HTTPMultipleAuth mix basic & bearer auth

func (*Middleware) HTTPPermissionACL

func (m *Middleware) HTTPPermissionACL(permissionCode string) func(http.Handler) http.Handler

HTTPPermissionACL http middleware for check acl permission

type OptionFunc added in v1.13.9

type OptionFunc func(*Middleware)

OptionFunc type

func SetACLPermissionChecker added in v1.13.9

func SetACLPermissionChecker(aclPermissionChecker interfaces.ACLPermissionChecker) OptionFunc

SetACLPermissionChecker option func

func SetBasicAuthValidator added in v1.13.9

func SetBasicAuthValidator(basicAuth interfaces.BasicAuthValidator) OptionFunc

SetBasicAuthValidator option func

func SetCache added in v1.14.6

func SetCache(cache interfaces.Cache, defaultCacheAge time.Duration) OptionFunc

SetCache option func

func SetTokenValidator added in v1.13.9

func SetTokenValidator(tokenValidator interfaces.TokenValidator) OptionFunc

SetTokenValidator option func

func SetUserIDExtractor added in v1.13.10

func SetUserIDExtractor(extractor func(tokenClaim *candishared.TokenClaim) (userID string)) OptionFunc

SetUserIDExtractor option func, custom extract user id from token claim for acl permission checker

Jump to

Keyboard shortcuts

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