jwt

package
v0.0.0-...-1f40b3c Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: MIT Imports: 7 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 {
	Email       string   `json:"email"`
	ID          string   `json:"id"`
	Permissions []string `json:"permissions"`
	jwt.StandardClaims
}

Claims stored or to be stored in JWT

type Client

type Client struct {
	Config Config
}

Client Creates and Parses Jwt

func (Client) CreateForUser

func (j Client) CreateForUser(user *db.User) (string, error)

CreateForUser returns signed JWT token

func (Client) GetJwtDataFromRequest

func (j Client) GetJwtDataFromRequest(r *http.Request) (*Claims, error)

GetJwtDataFromRequest takes in request and returns claims associated with that request

type Config

type Config struct {
	Secret string
	Expiry time.Duration
}

Config for handling JWT

type Manager

type Manager interface {
	GetJwtDataFromRequest(r *http.Request) (*Claims, error)
	CreateForUser(user *db.User) (string, error)
}

Manager for creating and parsing JWT

Jump to

Keyboard shortcuts

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