auth

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 5 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

Types

type SubscriberAuth

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

func (*SubscriberAuth) GenToken

func (sa *SubscriberAuth) GenToken(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