auth

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenUUID

func GenUUID(username string) string

GenUUID 生成UUID

func HashString added in v1.2.2

func HashString(input string) string

HashString 对内容进行 sha256

Types

type SubscriberAuth

type SubscriberAuth struct {
	Token      string        // Token
	Expiration time.Duration // 过期时间
	SecretKey  string        // 密钥
}

func (*SubscriberAuth) GenToken

func (sa *SubscriberAuth) GenToken(role, username string) (token string, err error)

GenToken 生成JWT token

func (*SubscriberAuth) ValidateToken

func (sa *SubscriberAuth) ValidateToken(tokenString string) (bool, error)

ValidateToken 验证和检查是否过期

Jump to

Keyboard shortcuts

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