jwt

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	libJWT.StandardClaims
	Email string `json:"email,omitempty"`
	Type  string `json:"type,omitempty"`
}

Claims ...

type JWT

type JWT struct {
	Options  *Options
	Logger   *logger.Logger
	Response *response.Response
}

JWT type struct

func New

func New(options *Options, response *response.Response) *JWT

New JWT

func (*JWT) Middleware

func (lib *JWT) Middleware(admin bool) gin.HandlerFunc

Middleware authorization middleware

func (*JWT) Parse

func (lib *JWT) Parse(token string) (*Claims, error)

Parse parsing signed token claims

func (*JWT) Sign

func (lib *JWT) Sign(payload Payload) (string, error)

Sign sign token with claims

type Options

type Options struct {
	Header string
	Secret string
	Issuer string
	Expire int64
}

Options - options struct

type Payload

type Payload struct {
	ID       string
	Email    string
	Audience string
	Admin    bool
}

Payload JWT payload

Jump to

Keyboard shortcuts

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