jwtauth

package
v0.0.0-...-cfb18d5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CasbinSubject

func CasbinSubject(c *gin.Context) string

CasbinSubject get casbin subject from context, which is roleKey.

func FromDataScope

func FromDataScope(ctx context.Context) string

FromDataScope get dataScope from context

func FromDeptId

func FromDeptId(ctx context.Context) int

FromDeptId get deptId from context

func FromPostId

func FromPostId(ctx context.Context) int

FromPostId get postId from context

func FromRoleId

func FromRoleId(ctx context.Context) int

FromRoleId get roleId from context

func FromRoleKey

func FromRoleKey(ctx context.Context) string

FromRoleKey get roleKey from context

func FromRoleName

func FromRoleName(ctx context.Context) string

FromRoleName get roleName from context

func FromUserId

func FromUserId(ctx context.Context) int

FromUserId get userId from context

func FromUserIdStr

func FromUserIdStr(ctx context.Context) string

FromUserIdStr get userId string from context

func FromUserName

func FromUserName(ctx context.Context) string

FromUserName get username from context

Types

type Config

type Config struct {
	Realm      string        `yaml:"realm" json:"realm"`
	SecretKey  string        `yaml:"secretKey" json:"secretKey"`
	Timeout    time.Duration `yaml:"timeout" json:"timeout"`
	MaxRefresh time.Duration `yaml:"maxRefresh" json:"maxRefresh"`
}

Config jwt 配置信息

type Identities

type Identities struct {
	UserId    int
	Username  string
	DeptId    int
	PostId    int
	RoleId    int
	RoleName  string
	RoleKey   string
	DataScope string
}

Identities jwt identity

func FromIdentity

func FromIdentity(ctx context.Context) Identities

FromIdentity get identity from context

type IdentityKey

type IdentityKey struct{}

IdentityKey identity key

Jump to

Keyboard shortcuts

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