paseto

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) auth.Tokens

Types

type Option

type Option func(*Options)

func ExpiresIn

func ExpiresIn(exp time.Duration) Option

func Issuer

func Issuer(s string) Option

func RefreshExpiresIn

func RefreshExpiresIn(exp time.Duration) Option

func SignWithPaseto

func SignWithPaseto(key ...interface{}) Option

type Options

type Options struct {
	Issuer string
	// SymmetricKey 对称密钥,专用于Paseto
	SymmetricKey interface{}

	ExpiresIn time.Duration

	RefreshExpiresIn time.Duration
}

type PasetoTokens

type PasetoTokens struct {
	// contains filtered or unexported fields
}

func (*PasetoTokens) Generate

func (p *PasetoTokens) Generate(user *auth.Principal) (*auth.Token, error)

Generate 生成 AccessToken

func (*PasetoTokens) Inspect

func (p *PasetoTokens) Inspect(token string) (*auth.Principal, error)

Verify 验证JWT的合法性并从中读取Principal实例

func (*PasetoTokens) Options

func (a *PasetoTokens) Options() interface{}

Jump to

Keyboard shortcuts

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