models

package
v0.0.0-...-314a858 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MEDODS_DB_NAME = "medods"
View Source
const REFRESH_TOKENS_COLLECTION = "refreshes"

Variables

View Source
var ErrEmptyConnectionString = errors.New("received an empty database connection string")
View Source
var ErrNoRefreshTokenPassed = errors.New("Found no refresh token in your request")
View Source
var ErrReceivedNoGUID = errors.New("No appropriate GUID passed in query parameters;")
View Source
var ErrTokenInvalid = errors.New("Provided JWT token is invalid")
View Source
var ErrTokenOccupied = errors.New("Token for this GUID already exists;")

Functions

This section is empty.

Types

type AuthTarget

type AuthTarget struct {
	GUID string `form:"guid" binding:"required"`
}

func (*AuthTarget) HasValidGUID

func (at *AuthTarget) HasValidGUID() bool

func (*AuthTarget) PutInOrderGUID

func (at *AuthTarget) PutInOrderGUID() error

type AuthTokenPair

type AuthTokenPair struct {
	AccessString  string     `json:"access_token"`
	AccessObject  *jwt.Token `json:"-"`
	RefreshString string     `json:"refresh_token"`
	RefreshObject *jwt.Token `json:"-"`
}

type DBI

type DBI interface {
	FindIfContains(string) bool
	InsertRefreshTokenHash(string, []byte) error
	GetRefreshTokenHash(string) ([]byte, error)
	DeleteRefreshTokenHash(string) error
}

type RefreshTokenModel

type RefreshTokenModel struct {
	UNID       string
	BcryptHash []byte
}

type WrapperDB

type WrapperDB struct {
	Client *mongo.Client
}

func InitWrapperDB

func InitWrapperDB(connURL string) *WrapperDB

func (*WrapperDB) DeleteRefreshTokenHash

func (wdb *WrapperDB) DeleteRefreshTokenHash(unid string) error

func (*WrapperDB) FindIfContains

func (wdb *WrapperDB) FindIfContains(tokenUNID string) bool

func (*WrapperDB) GetRefreshTokenHash

func (wdb *WrapperDB) GetRefreshTokenHash(unid string) ([]byte, error)

func (*WrapperDB) InsertRefreshTokenHash

func (wdb *WrapperDB) InsertRefreshTokenHash(UNID string, bcryptHash []byte) error

Jump to

Keyboard shortcuts

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