auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(hashedPassword, password string) error

Compare 比较密文和明文是否相同.

func Encrypt

func Encrypt(source string) (string, error)

Encrypt 使用 bcrypt 加密纯文本.

Types

type Authz

type Authz struct {
	*casbin.SyncedEnforcer
}

Authz 定义了一个授权器,提供授权功能.

func NewAuthz

func NewAuthz(db *gorm.DB) (*Authz, error)

NewAuthz 创建一个使用 casbin 完成授权的授权器.

func (*Authz) Authorize

func (a *Authz) Authorize(sub, obj, act string) (bool, error)

Authorize 用来进行授权.

Jump to

Keyboard shortcuts

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