auth

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyUserInfo = app.ContextKey("user_info")
)

Variables

This section is empty.

Functions

func BuildAuthInterceptor

func BuildAuthInterceptor(
	publicMethodMap map[string]bool,
	jwtSecret string,
) grpc.UnaryServerInterceptor

func CheckPermission added in v0.1.1

func CheckPermission(enforcer *casbin.Enforcer, role, method string) (bool, error)

CheckPermission checks if a user role has permission to access a method

func NewEnforcer added in v0.1.1

func NewEnforcer() (*casbin.Enforcer, error)

NewEnforcer creates a new Casbin enforcer with the RBAC model and policy

Types

type UserInfo

type UserInfo struct {
	UserID uint64
	Role   userpb.UserRole
}

func ParseUserToken

func ParseUserToken(tokenString, secret string) (*UserInfo, error)

Jump to

Keyboard shortcuts

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