gwt

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(secret string)

Config sets the secret and issuer of the default GWT

func IsExpires

func IsExpires(err error) bool

IsExpires returns a boolean indicating whether the error is known to report that a gwt token is expired.

func ParseToken

func ParseToken(tokenString string, v interface{}) (err error)

ParseToken parses a token

func SignToken

func SignToken(payload interface{}, expires time.Duration) (token string, err error)

SignToken creates a token with expires

Types

type Channel

type Channel struct {
	Payload   []byte
	ExpiresAt int64
	Issuer    string
}

Channel is a payload container includes expires and issuer for GWT

type GWT

type GWT struct {
	Secret string
}

GWT is an api token rsa crypto with gob encoding

func (*GWT) ParseToken

func (gwt *GWT) ParseToken(tokenString string, v interface{}) (err error)

ParseToken parses a token

func (*GWT) SignToken

func (gwt *GWT) SignToken(payload interface{}, expires time.Duration) (token string, err error)

SignToken creates a token with expires

Jump to

Keyboard shortcuts

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