auth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEntryFromRouteReader

func GetEntryFromRouteReader(r restful.RouteReader) http.Entry

Types

type HTTPAuther

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

internal todo

func NewAutherFromGRPC

func NewAutherFromGRPC(c *rpc.Client) *HTTPAuther

NewAutherFromGRPC 基于rpc的鉴权中间件

func (*HTTPAuther) Auth

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

func (*HTTPAuther) CheckPermission

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

func (*HTTPAuther) GetClientService

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

func (*HTTPAuther) GinAuthHandlerFunc

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

Gin Auth Middleware

func (*HTTPAuther) PermHandlerFunc

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

Gin Perm Middleware

func (*HTTPAuther) RestfulAuthHandlerFunc

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

func (*HTTPAuther) SetAllows

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

func (*HTTPAuther) SetLogger

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

SetLogger todo

func (*HTTPAuther) SetPermissionCheckMode

func (a *HTTPAuther) SetPermissionCheckMode(m PermissionCheckMode)

func (*HTTPAuther) ValidateIdentity

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

func (*HTTPAuther) ValidatePermissionByACL

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

func (*HTTPAuther) ValidatePermissionByPRBAC

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

type PermissionCheckMode

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