Documentation ¶
Overview ¶
Package auth contains code to ensure users are authorized to use the server after they have logged in.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JwtTokenizer ¶
type JwtTokenizer struct { TokenizerConfig // contains filtered or unexported fields }
JwtTokenizer creates java web tokens.
func (*JwtTokenizer) Create ¶
func (j *JwtTokenizer) Create(username string, points int) (string, error)
Create converts a user to a token string.
func (*JwtTokenizer) ReadUsername ¶
func (j *JwtTokenizer) ReadUsername(tokenString string) (string, error)
ReadUsername extracts the username from the token string.
type TokenizerConfig ¶
type TokenizerConfig struct { // TimeFunc is a function which should supply the current time since the unix epoch. // This is used for setting token lifespan. TimeFunc func() int64 // ValidSec is the length of time the token is valid from the issuing time, in seconds. ValidSec int64 }
TokenizerConfig contains fields which describe a Tokenizer.
func (TokenizerConfig) NewTokenizer ¶
func (cfg TokenizerConfig) NewTokenizer(key interface{}) (*JwtTokenizer, error)
NewTokenizer creates a Tokenizer that users the random number generator to generate tokens.
Click to show internal directories.
Click to hide internal directories.