passport

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: BSD-3-Clause Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	// Identifies principal that issued the JWT
	Iss string `yaml:"iss"`

	// Identifies the recipients that the JWT is intended for
	Aud []string `yaml:"aud"`

	// Identifies the subject of the JWT.
	Sub string `yaml:"sub"`

	// Identifies the time on which the JWT will start to be accepted for processing
	Nbf int64 `yaml:"nbf"`

	// Identifies the expiration time on and after which the JWT must not be accepted for processing
	Exp int64 `yaml:"exp"`
}

type Passport

type Passport struct {

	// Key used for signing
	Key string `yaml:"key"`

	// Token option
	Option `yaml:"option"`
}

func New

func New(key string, option Option) *Passport

New authentication

func (*Passport) Create

func (x *Passport) Create(jti string, context map[string]interface{}) (tokenString string, err error)

Create authentication token

func (*Passport) Verify

func (x *Passport) Verify(tokenString string) (claims jwt.MapClaims, err error)

Verify authentication token

Jump to

Keyboard shortcuts

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