auth

package module
v0.0.0-...-bd5514a Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

README

gAuth

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTokenNotFound ...
	ErrTokenNotFound = errors.New("token not found")
	// ErrInvalidTokenFormat ...
	ErrInvalidTokenFormat = errors.New("invalid token format")
	// ErrSignedOutToken ...
	ErrSignedOutToken = errors.New("token has been signed out")
	// ErrUnsupportedOperation ...
	ErrUnsupportedOperation = errors.New("unsupported operation")
)

Functions

func ExtractBearerToken

func ExtractBearerToken(token string) (string, error)

ExtractBearerToken ...

Types

type Auth

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

Auth ...

func NewAuth

func NewAuth(secret string, exp time.Duration) *Auth

NewAuth ...

func (*Auth) Gatekeeper

func (auth *Auth) Gatekeeper(next http.Handler) http.Handler

Gatekeeper ...

func (*Auth) GenerateToken

func (auth *Auth) GenerateToken(sub string) string

GenerateToken ...

func (*Auth) Invalidate

func (auth *Auth) Invalidate(token string) error

Invalidate ...

func (*Auth) SetBlackListStore

func (auth *Auth) SetBlackListStore(store BlackList)

SetBlackListStore ...

func (*Auth) Validate

func (auth *Auth) Validate(token string) (jwt.MapClaims, error)

Validate ...

type BlackList

type BlackList interface {
	AddKey(string) error
	Contains(string) (bool, error)
}

BlackList ...

Jump to

Keyboard shortcuts

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