auth

package
v0.0.0-...-8dc1090 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB
View Source
var RedisClient *redis.Client

Functions

func DaltonLogin

func DaltonLogin(username string, password string) (map[string]interface{}, string, string, http.CookieJar, error)

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(s int) (string, error)

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string.

func GenerateUID

func GenerateUID() (string, error)

GenerateUID creates a random session ID, for use with the session store.

func SetSession

func SetSession(name string, value SessionInfo)

SetSession stores the given value under the given name in the database. If the given name is already used, its value is overwritten.

Types

type SessionInfo

type SessionInfo struct {
	UserID int
}

func GetSession

func GetSession(name string) SessionInfo

GetSession retrieves the session information for the given name

func GetSessionFromAuthToken

func GetSessionFromAuthToken(authToken string) SessionInfo

Jump to

Keyboard shortcuts

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