auth

package
v1.1.10097 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const UserValueToken = "UserToken"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthBasic added in v1.0.11512

type AuthBasic struct {
	NewTokenData fncNewTokenData
	// contains filtered or unexported fields
}

func NewAuthBasic added in v1.0.11512

func NewAuthBasic(tokens Tokens, fnc fncNewTokenData) *AuthBasic

func (*AuthBasic) AdminAuth added in v1.0.11512

func (a *AuthBasic) AdminAuth(ctx *fasthttp.RequestCtx) bool

func (*AuthBasic) Auth added in v1.0.11512

func (a *AuthBasic) Auth(ctx *fasthttp.RequestCtx) bool

func (*AuthBasic) String added in v1.0.11512

func (a *AuthBasic) String() string

type AuthBearer

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

func NewAuthBearer

func NewAuthBearer(tokens Tokens) *AuthBearer

func (*AuthBearer) AdminAuth

func (a *AuthBearer) AdminAuth(ctx *fasthttp.RequestCtx) bool

func (*AuthBearer) Auth

func (a *AuthBearer) Auth(ctx *fasthttp.RequestCtx) bool

func (*AuthBearer) GetToken

func (a *AuthBearer) GetToken(ctx *fasthttp.RequestCtx) TokenData

func (*AuthBearer) NewToken added in v1.0.11512

func (a *AuthBearer) NewToken(userData TokenData) (string, error)

func (*AuthBearer) RemoveToken added in v1.0.11512

func (a *AuthBearer) RemoveToken(s string) error

func (*AuthBearer) String

func (a *AuthBearer) String() string

type MapTokens added in v1.0.11512

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

func NewMapTokens added in v1.0.11512

func NewMapTokens(expiresIn time.Duration) *MapTokens

func (*MapTokens) GetToken added in v1.0.11512

func (m *MapTokens) GetToken(s string) TokenData

func (*MapTokens) NewToken added in v1.0.11512

func (m *MapTokens) NewToken(userData TokenData) (string, error)

func (*MapTokens) RemoveToken added in v1.0.11512

func (m *MapTokens) RemoveToken(s string) error

type TokenData added in v1.0.11512

type TokenData interface {
	IsAdmin() bool
	GetUserID() int
}

type Tokens

type Tokens interface {
	NewToken(userData TokenData) (string, error)
	GetToken(s string) TokenData
	RemoveToken(s string) error
}

Jump to

Keyboard shortcuts

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