Documentation
¶
Index ¶
- func CreateCookie(data interface{}, hostName string, cookieName string, duration time.Duration, ...)
- func CreateToken(data interface{}, expiration time.Time) (string, error)
- func Decrypt(data []byte, key []byte) ([]byte, error)
- func Encrypt(data []byte, key []byte) ([]byte, error)
- func ExtractAndValidateToken(r *http.Request, cookieName string, v interface{}, checkXSRF bool) (bool, error)
- func Init(keyfile string, debug bool)
- func InitFromString(key string, debug bool)
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCookie ¶
func CreateCookie(data interface{}, hostName string, cookieName string, duration time.Duration, w http.ResponseWriter)
CreateCookie creates a token with the given data and returns it in a cookie
func CreateToken ¶
CreateToken creates a token with the given data
func ExtractAndValidateToken ¶
func ExtractAndValidateToken(r *http.Request, cookieName string, v interface{}, checkXSRF bool) (bool, error)
ExtractAndValidateToken extracts the token from the request, validates it, and return the data n the value pointed to by v
func InitFromString ¶
InitFromString inits the main token manager from a given string
Types ¶
Click to show internal directories.
Click to hide internal directories.