entities

package
v0.0.0-...-84f1f66 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidEntityId

func ValidEntityId(entityId string) bool

func ValidPassword

func ValidPassword(password string) bool

Types

type Entity

type Entity struct {
	Id             string      `json:"id" bson:"_id"`
	Type           EntityType  `json:"type" bson:"type"`
	PasswordHash   []byte      `json:"passwordHash" bson:"passwordHash"`
	Validated      bool        `json:"validated" bson:"validated"`
	Suspended      bool        `json:"suspended" bson:"suspended"`
	TotpConfigured bool        `json:"totpConfigured" bson:"totpConfigured"`
	TotpUri        string      `json:"totpUri" bson:"totpUri"`
	RecoveryTokens []string    `json:"recoveryTokens" bson:"recoveryTokens"`
	Roles          roles.Roles `json:"roles" bson:"roles"`
}

func NewEntity

func NewEntity(typ EntityType, entityId string, password string, totpConfig config.TotpConfig) (u Entity, err error)

func (*Entity) Enable

func (u *Entity) Enable()

func (*Entity) GenerateTotp

func (u *Entity) GenerateTotp() (code string, err error)

func (*Entity) HasPassword

func (u *Entity) HasPassword(password string) bool

func (*Entity) Invalidate

func (u *Entity) Invalidate()

func (*Entity) IsAdmin

func (u *Entity) IsAdmin() bool

func (*Entity) IsEnabled

func (u *Entity) IsEnabled() bool

func (*Entity) IsMachine

func (u *Entity) IsMachine() bool

func (*Entity) IsTotpToConfigure

func (u *Entity) IsTotpToConfigure() bool

func (*Entity) IsUser

func (u *Entity) IsUser() bool

func (*Entity) ResetTotp

func (u *Entity) ResetTotp(config config.TotpConfig) error

func (*Entity) SetPassword

func (u *Entity) SetPassword(password string) (err error)

func (*Entity) SetTotpConfigured

func (u *Entity) SetTotpConfigured(configured bool)

func (*Entity) Suspend

func (u *Entity) Suspend()

func (*Entity) Validate

func (u *Entity) Validate()

func (*Entity) ValidateTotp

func (u *Entity) ValidateTotp(code string) (bool, error)

type EntityMetadata

type EntityMetadata map[string]string

type EntityType

type EntityType int
const (
	TypeUndefined EntityType = iota
	TypeUser
	TypeMachine
	TypeAdmin
)

type TotpParams

type TotpParams struct {
	Enabled bool
	Issuer  string
}

Jump to

Keyboard shortcuts

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