jwt

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 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 Service

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

Service provides a Json-Web-Token authentication implementation

func New

func New(algo, secret string, duration int) *Service

New generates new JWT service necessery for auth middleware

func (*Service) GenerateToken

func (j *Service) GenerateToken(claims map[string]interface{}, expire *time.Time) (string, int, error)

GenerateToken generates new Service token and populates it with user data

func (*Service) MWFunc

func (j *Service) MWFunc() echo.MiddlewareFunc

MWFunc makes JWT implement the Middleware interface.

func (*Service) ParseToken

func (j *Service) ParseToken(input string) (*jwt.Token, error)

ParseToken parses token from string

func (*Service) ParseTokenFromHeader

func (j *Service) ParseTokenFromHeader(c echo.Context) (*jwt.Token, error)

ParseTokenFromHeader parses token from Authorization header

Jump to

Keyboard shortcuts

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