session

package
v0.0.0-...-f97ce34 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Month = 30 * Day
	Day   = 24 * time.Hour

	RefreshTokenKey = "refresh_token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTAuth

type JWTAuth struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type JWTKeys

type JWTKeys struct {
	*decoder.Decoder
	// contains filtered or unexported fields
}

func NewJWTKeys

func NewJWTKeys(logger *zap.Logger, cache cache.Cache) (*JWTKeys, error)

func (*JWTKeys) CreateAccessToken

func (j *JWTKeys) CreateAccessToken(u light.User) (string, error)

func (*JWTKeys) CreateRefreshToken

func (j *JWTKeys) CreateRefreshToken(accessToken string, u *light.User) (string, error)

func (*JWTKeys) ExtractAccessToken

func (j *JWTKeys) ExtractAccessToken(r *http.Request) (*light.User, error)

func (*JWTKeys) ExtractRefreshToken

func (j *JWTKeys) ExtractRefreshToken(rawToken string) (*RefreshToken, error)

func (*JWTKeys) GenerateAuthTokens

func (j *JWTKeys) GenerateAuthTokens(u *light.User) (*req.AuthTokenData, error)

func (*JWTKeys) GenerateToken

func (j *JWTKeys) GenerateToken(m jwt.MapClaims) (string, error)

func (*JWTKeys) GetSignKey

func (j *JWTKeys) GetSignKey() (*rsa.PrivateKey, error)

func (*JWTKeys) GetVerifyKey

func (j *JWTKeys) GetVerifyKey() (*rsa.PublicKey, error)

func (*JWTKeys) ReadKeys

func (j *JWTKeys) ReadKeys() error

type RefreshToken

type RefreshToken struct {
	Token string `json:"token"`
	UID   int64  `json:"uid"`
	UUID  string `json:"uuid"`
}

Jump to

Keyboard shortcuts

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