interceptor

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEntryFromRouteReader added in v0.7.4

func GetEntryFromRouteReader(r restful.RouteReader) http.Entry

func GrpcAuthUnaryServerInterceptor

func GrpcAuthUnaryServerInterceptor(c *client.Client) grpc.UnaryServerInterceptor

GrpcAuthUnaryServerInterceptor returns a new unary server interceptor for auth.

Types

type HTTPAuther

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

internal todo

func NewHTTPAuther

func NewHTTPAuther(c *client.Client) *HTTPAuther

NewInternalAuther 内部使用的auther

func (*HTTPAuther) Auth

func (a *HTTPAuther) Auth(r *http.Request, entry httpb.Entry) (
	authInfo interface{}, err error)

func (*HTTPAuther) CheckPermission added in v0.6.5

func (a *HTTPAuther) CheckPermission(ctx context.Context, tk *token.Token, e httpb.Entry) error

func (*HTTPAuther) GetClientService added in v0.6.5

func (a *HTTPAuther) GetClientService(ctx context.Context) (*micro.Micro, error)

func (*HTTPAuther) GinAuthHandlerFunc added in v0.7.5

func (a *HTTPAuther) GinAuthHandlerFunc() gin.HandlerFunc

Gin Auth Middleware

func (*HTTPAuther) PermHandlerFunc added in v0.7.4

func (a *HTTPAuther) PermHandlerFunc() gin.HandlerFunc

Gin Perm Middleware

func (*HTTPAuther) RestfulAuthHandlerFunc added in v0.7.5

func (a *HTTPAuther) RestfulAuthHandlerFunc(req *restful.Request, resp *restful.Response, chain *restful.FilterChain)

func (*HTTPAuther) SetAllows added in v0.7.4

func (a *HTTPAuther) SetAllows(allows ...fmt.Stringer)

func (*HTTPAuther) SetLogger

func (a *HTTPAuther) SetLogger(l logger.Logger)

SetLogger todo

func (*HTTPAuther) SetPermissionCheckMode added in v0.6.5

func (a *HTTPAuther) SetPermissionCheckMode(m PermissionCheckMode)

func (*HTTPAuther) ValidateIdentity

func (a *HTTPAuther) ValidateIdentity(ctx context.Context, accessToken string) (*token.Token, error)

func (*HTTPAuther) ValidatePermissionByACL added in v0.6.5

func (a *HTTPAuther) ValidatePermissionByACL(ctx context.Context, tk *token.Token, e httpb.Entry) error

func (*HTTPAuther) ValidatePermissionByPRBAC added in v0.6.5

func (a *HTTPAuther) ValidatePermissionByPRBAC(ctx context.Context, tk *token.Token, e httpb.Entry) error

type PermissionCheckMode added in v0.6.5

type PermissionCheckMode int
const (
	// PRBAC_MODE 基于策略的权限校验
	PRBAC_MODE PermissionCheckMode = 1
	// ACL_MODE 基于用户类型的权限校验
	ACL_MODE = 2
)

Jump to

Keyboard shortcuts

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