app

package
v0.0.0-...-41fd8b9 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 6 Imported by: 1

README

app folder

In the app folder is where you put all your collection of functions that don't belong anywhere else.

For info about the db and jio folder you can find a readme in there.

app/token

In here are all the functions for generating, removing and refreshing tokens, if you need to change any of this, this is where you find it.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Users contains all the sessions with sessionkey as key
	Users map[string]User
	// CreateSessionMux is the mux to keep everything safe
	CreateSessionMux sync.Mutex
)

Functions

func CreateUserToken

func CreateUserToken(username string) string

CreateUserToken creates a user bound to a token

func DeleteUserToken

func DeleteUserToken(username string, token string) *jio.ErrorMsg

DeleteUserToken deletes the user out of the Users map

func RefreshUserToken

func RefreshUserToken(username string, token string) (string, *jio.ErrorMsg)

RefreshUserToken refreshes the user token

Types

type User

type User struct {
	AuthToken         string
	Username          string
	TokenCreated      time.Time
	TokenExpiresAt    time.Time
	TokenGetDeletedAt time.Time
	Timer             *time.Timer
}

User is a struct for every logged in client

func GetUserToken

func GetUserToken(username string, token string) (*User, *jio.ErrorMsg)

GetUserToken gets the token bound to the user if exists

func (*User) GetTokenPostResponse

func (user *User) GetTokenPostResponse() resmodels.TokenPost

GetTokenPostResponse returns the Post data for Get Token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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