jwtauth

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package jwtauth is responsible for implementing the auth methods specified in the auth folder of the inspr pkg.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTauth

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

JWTauth implements the Auth interface for jwt authetication provider

func NewJWTauth

func NewJWTauth(rsaPublicKey *rsa.PublicKey) *JWTauth

NewJWTauth takes an *rsa.PublicKey and returns an structure that implements the auth interface

func (*JWTauth) Init

func (JA *JWTauth) Init(key string, load auth.Payload) ([]byte, error)

Init receives a payload and returns it in signed jwt format. Uses JWT authentication provider

func (*JWTauth) Refresh

func (JA *JWTauth) Refresh(token []byte) ([]byte, error)

Refresh refreshes a jwt token. Uses JWT authentication provider

func (*JWTauth) Tokenize

func (JA *JWTauth) Tokenize(load auth.Payload) ([]byte, error)

Tokenize receives a payload and returns it in signed jwt format. Uses JWT authentication provider

func (*JWTauth) Validate

func (JA *JWTauth) Validate(token []byte) (*auth.Payload, []byte, error)

Validate is a wrapper that checks the token of the http request and if it's valid, proceeds to execute the request and if it isn't valid returns an error

Jump to

Keyboard shortcuts

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