auth

package
v0.0.0-...-1b39580 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	AuthMethod  string    `mapstructure:"method"`
	APIKey      string    `mapstructure:"apiKey"`
	BearerToken string    `mapstructure:"bearerToken"`
	BasicAuth   BasicAuth `mapstructure:"basic"`
	JWTToken    JWTConfig `mapstructure:"jwt"`
}

type AuthType

type AuthType int

type BasicAuth

type BasicAuth struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

type IAuthType

type IAuthType interface {
	Middleware(h http.HandlerFunc) http.HandlerFunc
}

func NewAuthMethod

func NewAuthMethod(cfg Auth) (IAuthType, error)

func NewAuthorizer

func NewAuthorizer(cfg Auth) (IAuthType, error)

type JWTConfig

type JWTConfig struct {
	Access  Token `mapstructure:"accessToken"`
	Refresh Token `mapstructure:"refreshToken"`
}

type Token

type Token struct {
	PrivateKey string        `mapstructure:"privateKey"`
	PublicKey  string        `mapstructure:"publicKey"`
	ExpiresIn  time.Duration `mapstructure:"expiresIn"`
	MaxAge     int           `mapstructure:"maxAge"`
}

Jump to

Keyboard shortcuts

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