token

package
v0.0.0-...-7238798 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenTypeRefresh = "refresh"
	TokenTypeAccess  = "access"

	TokenTypeRefreshTTL = time.Duration(24 * time.Hour)
	TokenTypeAccessTTL  = time.Duration(15 * time.Minute)
)

Variables

View Source
var (
	MsgStatusOK            = []byte("{\"status\": \"OK\"}")
	MsgUserNotFound        = []byte("{\"error\": \"user not found\"}")
	MsgInvalidDataFormat   = []byte("{\"error\": \"data format error\"}")
	MsgCheckPasswordError  = []byte("{\"error\": \"check password error\"}")
	MsgInvalidPassword     = []byte("{\"error\": \"password is invalid\"}")
	MsgInternalError       = []byte("{\"error\": \"internal error\"}")
	MsgRefreshTokenEmpty   = []byte("{\"error\": \"refresh token is empty\"}")
	MsgInvalidRefreshToken = []byte("{\"error\": \"refresh token is invalid\"}")
)

JSON messages

Functions

func RegisterSubrouter

func RegisterSubrouter(base *mux.Router, path string, accountProvider account.AccountProvider, cfg config.JWTConfig) error

RegisterSubrouter register subrouter for work with token of user

Types

type Credential

type Credential struct {
	Username string
	Password string
}

type ParsedToken

type ParsedToken struct {
	UID       string
	Type      string
	ExpiresOn int64
}

type RefreshToken

type RefreshToken struct {
	RefreshToken string
	AccessToken  string
}

Jump to

Keyboard shortcuts

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