middleware

package
v0.0.0-...-e041085 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JwtTokenKey = env.AuthJwtTokenKey()
View Source
var VerificationTypeConstants = struct {
	APIToken    VerificationType
	GoogleToken VerificationType
	JWTToken    VerificationType
	WorkerToken VerificationType
}{
	APIToken:    1,
	GoogleToken: 2,
	JWTToken:    3,
	WorkerToken: 4,
}

VerificationTypeConstants constant for verification type

Functions

This section is empty.

Types

type BearerToken

type BearerToken = []byte

func GetBearerToken

func GetBearerToken(r *http.Request) (BearerToken, error)

GetBearerToken ...

type Error

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

type Middleware

type Middleware struct {
	Client *http.Client
}

Middleware is a helper for route to validate a http Request

func (Middleware) ApiToken

func (m Middleware) ApiToken(w http.ResponseWriter, r *http.Request) (*http.Request, *Error)

ApiToken is a middleware to check Authorization Bearer Header is a valid `env` Api Token

func (Middleware) Auth

Auth is a route middleware that will serve http handler if either `Api Token` or `Jwt Token` is valid Use this middleware for routes that require use to be logged.

func (Middleware) Cors

Cors is a middleware to handle Cross Origin Request

func (Middleware) Do

Do is Helper for executes a middleware

func (Middleware) Group

func (m Middleware) Group(h http.Handler, verifyAll bool, handlers ...MiddlewareFunc) http.HandlerFunc

Group is Helper for executes bunch of middleware

func (Middleware) Guest

func (m Middleware) Guest(h http.Handler) http.HandlerFunc

Guest is a route middleware that will serve http handler if `Api Token` is valid. Use this middleware for routes that not require use to be logged

func (Middleware) JwtToken

func (m Middleware) JwtToken(w http.ResponseWriter, r *http.Request) (*http.Request, *Error)

JwtToken is a middleware to check Authorization Bearer Header is a valid Jwt Token

func (Middleware) RetoolAuth

func (m Middleware) RetoolAuth(h http.Handler) http.HandlerFunc

RetoolAuth is a route middleware that will handle Retool Authentication method

func (Middleware) Verify

func (m Middleware) Verify(h http.Handler, handlers ...MiddlewareFunc) http.HandlerFunc

Verify is helper for executes list of middleware from routes

type MiddlewareFunc

type MiddlewareFunc = func(w http.ResponseWriter, r *http.Request) (*http.Request, *Error)

type VerificationType

type VerificationType int

VerificationType ...

Jump to

Keyboard shortcuts

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