token

package
Version: v0.0.0-...-40d3858 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const UserSessionPrefix = "u_session:"

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenManager

type TokenManager struct{}

func TokenMgr

func TokenMgr() *TokenManager

func (*TokenManager) CheckJWT

func (tokenMgr *TokenManager) CheckJWT(tokenString string) (string, error)

Check JWT from tokenString

func (*TokenManager) CleanJWT

func (tokenMgr *TokenManager) CleanJWT(ctx context.Context) error

Clean JWT from ctx

func (*TokenManager) Decode

func (tokenMgr *TokenManager) Decode(tokenString string, secretKey string) (*jwt.StandardClaims, error)

func (*TokenManager) Encode

func (tokenMgr *TokenManager) Encode(user User, issuer string, subject string, secretKey string, d time.Duration) (string, error)

func (*TokenManager) GenerateJWT

func (tokenMgr *TokenManager) GenerateJWT(user User) (string, string, error)

Generate JWT from Uuid

func (*TokenManager) GetClaims

func (tokenMgr *TokenManager) GetClaims(tokenString string) (*jwt.StandardClaims, error)

Get Claims from tokenString

func (*TokenManager) GetJWT

func (tokenMgr *TokenManager) GetJWT(ctx context.Context) (string, error)

Get JWT from ctx

type User

type User interface {
	GetIdStr() string
	GetUuid() string
}

Source Files

Jump to

Keyboard shortcuts

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