auth

package
v1.1.10015 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const UserValueToken = "UserToken"

Variables

This section is empty.

Functions

This section is empty.

Types

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) String

func (a *AuthBearer) String() string

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