auth

package
v0.0.0-...-a35a875 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAuthTokenString

func GenerateAuthTokenString(account string, roles ...string) (string, error)

func ParseAuthTokenString

func ParseAuthTokenString(tokenString string) (string, []string, error)

Types

type AuthToken

type AuthToken struct {
	Account string
	Roles   []string
	Expires time.Time
}

func GetAuthTokenFromJWTMapClaims

func GetAuthTokenFromJWTMapClaims(claims jwt.MapClaims) *AuthToken

func (*AuthToken) ToJWTMapClaims

func (a *AuthToken) ToJWTMapClaims() jwt.MapClaims

func (*AuthToken) Valid

func (a *AuthToken) Valid() error

type LoginSession

type LoginSession struct {
	Id      string `json:"-"`
	Account string `json:"account"`
}

func CheckLoginSession

func CheckLoginSession(ctx context.Context, id string) (*LoginSession, error)

func NewLoginSession

func NewLoginSession(account string) *LoginSession

func (*LoginSession) SaveToRedis

func (ls *LoginSession) SaveToRedis(ctx context.Context) error

Jump to

Keyboard shortcuts

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