auth

package
v0.0.0-...-e006840 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthRPCSet = wire.NewSet(wire.Struct(new(AuthRPC), "*"))

Functions

This section is empty.

Types

type AuthRPC

type AuthRPC struct {
	Logger *logrus.Logger
	Redis  *redis.Client
}

func (*AuthRPC) AbortWithError

func (auth *AuthRPC) AbortWithError(ctx context.Context, args ...any)

func (*AuthRPC) CompareCombination

func (auth *AuthRPC) CompareCombination(md metadata.MD, userID string, clientIP string) bool

验证规则: 1. 当前请求IP或是header中的clientIP,与JWT中当初token签发IP相同 2. header中的userID与JWT中userID相同

func (*AuthRPC) ValidateSignature

func (auth *AuthRPC) ValidateSignature(
	ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (resp interface{}, err error)

func (*AuthRPC) ValidateToken

func (auth *AuthRPC) ValidateToken(
	ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (resp interface{}, err error)

Jump to

Keyboard shortcuts

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