Documentation ¶
Overview ¶
*
@author: taco @Date: 2023/9/27 @Time: 10:16
*
Index ¶
- Variables
- func GetAccessToken(headAuthorization []string) string
- func JwtStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func RbacStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func ReturnProtoMsg(result CommonResponse, method string) (proto.Message, error)
- type CommonData
- type CommonResponse
- type Config
- type JwtVerifyMiddleware
- type MiddleContext
- func (SvcCtx *MiddleContext) JwtUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func (SvcCtx *MiddleContext) RbacUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- type ParseAccessKeyMiddleware
- type Resp
- func (*Resp) Descriptor() ([]byte, []int)deprecated
- func (x *Resp) GetCode() int32
- func (x *Resp) GetMsg() string
- func (x *Resp) GetPath() string
- func (x *Resp) GetRequestID() string
- func (*Resp) ProtoMessage()
- func (x *Resp) ProtoReflect() protoreflect.Message
- func (x *Resp) Reset()
- func (x *Resp) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var File_result_proto protoreflect.FileDescriptor
Functions ¶
func GetAccessToken ¶
func JwtStreamInterceptor ¶
func JwtStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
func RbacStreamInterceptor ¶
func RbacStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
func ReturnProtoMsg ¶
func ReturnProtoMsg(result CommonResponse, method string) (proto.Message, error)
Types ¶
type CommonData ¶
type CommonData struct { RequestID string `json:"requestId"` Data interface{} `json:"data"` }
type CommonResponse ¶
type JwtVerifyMiddleware ¶
func NewJwtVerifyMiddleware ¶
func NewJwtVerifyMiddleware(name string, rdb *redis.Redis, rbac *casbin.Enforcer) *JwtVerifyMiddleware
func (*JwtVerifyMiddleware) Handle ¶
func (m *JwtVerifyMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc
type MiddleContext ¶
type MiddleContext struct { // note: 中间件上下文 //Dao *dao.Dao SvcName string Redis *redis.Redis Rbac *casbin.Enforcer }
func NewMiddlewareContext ¶
func NewMiddlewareContext(in Config) *MiddleContext
func (*MiddleContext) JwtUnaryInterceptor ¶
func (SvcCtx *MiddleContext) JwtUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
func (*MiddleContext) RbacUnaryInterceptor ¶
func (SvcCtx *MiddleContext) RbacUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
type ParseAccessKeyMiddleware ¶
type ParseAccessKeyMiddleware struct { }
func NewParseAccessKeyMiddleware ¶
func NewParseAccessKeyMiddleware() *ParseAccessKeyMiddleware
func (*ParseAccessKeyMiddleware) Handle ¶
func (m *ParseAccessKeyMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc
type Resp ¶
type Resp struct { Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` RequestID string `protobuf:"bytes,3,opt,name=requestID,proto3" json:"requestID,omitempty"` Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` // contains filtered or unexported fields }
func (*Resp) Descriptor
deprecated
func (*Resp) GetRequestID ¶
func (*Resp) ProtoMessage ¶
func (*Resp) ProtoMessage()
func (*Resp) ProtoReflect ¶
func (x *Resp) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.