auth

package
v0.0.0-...-b33f08c Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TokenCache = make(map[string]string)

TokenCache is an in-memory cache of user tokens

Functions

func Authenticate

func Authenticate(username, password string) (string, string, error)

Authenticate will authenticate a login request

func LoadTokenCache

func LoadTokenCache() error

LoadTokenCache reads the file contents into memory (why?)

func LookupToken

func LookupToken(player string) (string, error)

LookupToken looks up a token from in-memory token cache

func PlayerUUIDLookup

func PlayerUUIDLookup(player string) (string, error)

PlayerUUIDLookup looks up a UUID for a playerName

func RemoveToken

func RemoveToken(player string)

RemoveToken will erase a name/token pair from the in-memory copy of the token cache

func VerifyToken

func VerifyToken(name, token string) bool

VerifyToken checks the playerName and token against the token cache

Types

type UUIDplayer

type UUIDplayer struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Legacy bool   `json:"legacy"`
	Demo   bool   `json:"demo"`
}

UUIDplayer is the structure of data expected as a result of a mojang profile request

Jump to

Keyboard shortcuts

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