auth

package
v0.0.86 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUser

func GetUser(ctx context.Context) (*contracts.UserInfo, error)

func GetUserPermissions added in v0.0.28

func GetUserPermissions(email string) []*auth.Permission

func HasPermissionFor added in v0.0.28

func HasPermissionFor[T ~int | ~int64](user *contracts.UserInfo, permission rbac.Permission, id T) bool

func MustGetUser

func MustGetUser(ctx context.Context) *contracts.UserInfo

func SetUser

func SetUser(ctx context.Context, info *contracts.UserInfo) context.Context

func StreamServerInterceptor

func StreamServerInterceptor() grpc.StreamServerInterceptor

func UnaryServerInterceptor

func UnaryServerInterceptor() grpc.UnaryServerInterceptor

Types

type Auth

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

func NewAuth

func NewAuth(priKey *rsa.PrivateKey, pubKey *rsa.PublicKey) *Auth

func (*Auth) Sign

func (a *Auth) Sign(info *contracts.UserInfo) (*contracts.SignData, error)

func (*Auth) VerifyToken

func (a *Auth) VerifyToken(t string) (*contracts.JwtClaims, bool)

type CtxTokenInfo

type CtxTokenInfo struct{}

Jump to

Keyboard shortcuts

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