token

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MPL-2.0 Imports: 6 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 {
	jwt.StandardClaims
	Userid   string `json:"userid"`
	AuthTags string `json:"auth_tags"`
}

Claims is a set of fields to describe a user

type Tokenizer

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

Tokenizer is a token generator

func New

func New(secret, issuer string) *Tokenizer

New creates a new Tokenizer

func (*Tokenizer) Generate

func (t *Tokenizer) Generate(u *usermodel.Model, duration int64, subject, id string) (string, *Claims, *governor.Error)

Generate returns a new jwt token from a user model

func (*Tokenizer) GenerateFromClaims

func (t *Tokenizer) GenerateFromClaims(claims *Claims, duration int64, subject, id string) (string, *governor.Error)

GenerateFromClaims creates a new jwt from a set of claims

func (*Tokenizer) GetClaims

func (t *Tokenizer) GetClaims(tokenString string, subject string) (bool, *Claims)

GetClaims returns the claims of a token without verifying time or id claims

func (*Tokenizer) Validate

func (t *Tokenizer) Validate(tokenString, subject, id string) (bool, *Claims)

Validate returns whether a token is valid or not

func (*Tokenizer) ValidateSkipTime

func (t *Tokenizer) ValidateSkipTime(tokenString, subject, id string) (bool, *Claims)

Validate returns whether a token is valid or not skipping validating time claims

Jump to

Keyboard shortcuts

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