standard

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const AccessTokenExpireInterval = 7 * 24 * 60 * 60

TODO(从配置中读取)

View Source
const AccessTokenIss = "github.com/goecology/egoshop"

TODO(两个都从配置里面读取)

View Source
const AccessTokenKey = "ecologysK#xo"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenTicket

type AccessTokenTicket struct {
	AccessToken string `json:"accessToken"`
	ExpiresIn   int64  `json:"expiresIn"`
}

type JwtTokenAccessor

type JwtTokenAccessor struct {
}

func (*JwtTokenAccessor) DecodeAccessToken

func (g *JwtTokenAccessor) DecodeAccessToken(tokenStr string) (resp map[string]interface{}, err error)

func (*JwtTokenAccessor) EncodeAccessToken

func (g *JwtTokenAccessor) EncodeAccessToken(jwtId int, uid int, startTime int64) (tokenStr string, err error)

type TokenAccessor

type TokenAccessor interface {
	CreateAccessToken(c *gin.Context, uid int, startTime int64) (resp AccessTokenTicket, err error)
	CheckAccessToken(c *gin.Context, tokenStr string) bool
	RefreshAccessToken(c *gin.Context, tokenStr string, startTime int64) (resp AccessTokenTicket, err error)
	DecodeAccessToken(tokenStr string) (resp map[string]interface{}, err error)
}

Jump to

Keyboard shortcuts

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