auth

package module
v0.0.0-...-2261f65 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyAuth

type APIKeyAuth struct {
	Token string
	User  string
}

func (*APIKeyAuth) Header

func (a *APIKeyAuth) Header() string

func (*APIKeyAuth) HeaderKey

func (a *APIKeyAuth) HeaderKey() string

func (*APIKeyAuth) Valid

func (a *APIKeyAuth) Valid(auth string) (bool, []KeyPair)

type Auth

type Auth struct {
	Authorization []Authorization
}

func NewAuth

func NewAuth(auth ...Authorization) *Auth

func (*Auth) Add

func (a *Auth) Add(auth Authorization)

func (*Auth) EchoMiddleware

func (a *Auth) EchoMiddleware(next echo.HandlerFunc) echo.HandlerFunc

func (*Auth) GinMiddleware

func (a *Auth) GinMiddleware(c *gin.Context)

type Authorization

type Authorization interface {
	// HeaderKey is the key to use for the Authorization header.
	HeaderKey() string
	// Valid validates if the header is valid
	Valid(string) (bool, []KeyPair)
	//Create a new Authorization Header
	Header() string
}

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func (*BasicAuth) Header

func (a *BasicAuth) Header() string

func (*BasicAuth) HeaderKey

func (a *BasicAuth) HeaderKey() string

func (*BasicAuth) Valid

func (a *BasicAuth) Valid(auth string) (bool, []KeyPair)

type KeyPair

type KeyPair struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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