Back to godoc.org

Package token

v0.2.7
Latest Go to latest

The highest tagged major version is .

Published: Mar 23, 2020 | License: MPL-2.0 | Module: xorkevin.dev/governor

Index

type Claims

type Claims struct {
	jwt.StandardClaims
	Userid string `json:"userid"`
	ID     string `json:"id"`
	Key    string `json:"key"`
}

Claims is a set of fields to describe a user

type Service

type Service interface {
	governor.Service
	Tokenizer
}

func New

func New() Service

New creates a new Tokenizer

type Tokenizer

type Tokenizer interface {
	Generate(userid string, duration int64, subject, id, key string) (string, *Claims, error)
	GenerateFromClaims(claims *Claims, duration int64, subject, key string) (string, *Claims, error)
	Validate(tokenString, subject string) (bool, *Claims)
	GetClaims(tokenString, subject string) (bool, *Claims)
}

Tokenizer is a token generator

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier