authtoken

package
v0.0.0-...-3056a10 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package files is responsible for saving files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUser

func CheckUser(authtoken string) (string, time.Time, bool)

CheckUser checks whether an authstring belongs to a user and the user is valid. It will also check valid until.

func DeleteToken

func DeleteToken(authtoken string) error

DeleteToken removes a single token fom database.

func DeleteUserToken

func DeleteUserToken(user string) (int64, error)

DeleteUserToken removes all authtoken associated by a user. It returns the number of deleted tokens.

func InitDB

func InitDB(config string) error

InitDB initialises the database. Must be called before any other function. This stub will return an error if no build tags are set.

func StartCleanupWorker

func StartCleanupWorker()

Types

type Authtoken

type Authtoken struct {
	ID         string
	User       string
	ValidUntil time.Time
}

Authtoken represents an authtoken for user validation.

func GetAuthtokenOfUser

func GetAuthtokenOfUser(user string) ([]Authtoken, error)

GetAuthtokenOfUser returns all auth token associated by a user.

func GetNewToken

func GetNewToken(user string, minutesValid int) (Authtoken, error)

GetNewToken inserts an authtoken into the database and returns it. The token will be generated uniquely.

Jump to

Keyboard shortcuts

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