jwt

package
v0.0.0-...-2b407f8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWT

type JWT interface {
	ParseToken(authHeader string) (jwt.MapClaims, error)
	GenerateToken(user *types.User) (string, error)
	GenerateRefreshToken(userId uint) (string, error)
}

func NewJWT

func NewJWT(config *config.Config) (JWT, error)

New generates new JWT service necessary for auth middleware

type Service

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

Service provides a Json-Web-Token authentication implementation

func (*Service) GenerateRefreshToken

func (s *Service) GenerateRefreshToken(id uint) (string, error)

GenerateRefreshToken generates new refresh JWT token

func (*Service) GenerateToken

func (s *Service) GenerateToken(u *types.User) (string, error)

GenerateToken generates new JWT token and populates it with user data

func (*Service) ParseToken

func (s *Service) ParseToken(tokenString string) (jwt.MapClaims, error)

ParseToken parses token from Authorization header

Jump to

Keyboard shortcuts

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