auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(user schema.User) (string, error)

CreateToken generate tokens used for auth

func GetEnforcer

func GetEnforcer() *casbin.Enforcer

func Setup

func Setup()

func SetupCasbin

func SetupCasbin()

func SetupJwt

func SetupJwt()

Types

type CustomClaims

type CustomClaims struct {
	*jwt.StandardClaims
	UserInfo
}

func ParseToken

func ParseToken(tokenString string) (*CustomClaims, error)

ParseToken parsing token

type UserInfo

type UserInfo struct {
	UserID int64  `json:"user_id"`
	Roles  string `json:"roles"`
}

Jump to

Keyboard shortcuts

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