gwt

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(secret string, encoding 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
	Encoding string
}

GWT is an api token rsa crypto

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