identity_models

package
v0.0.0-...-b31fe97 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPepper = errors.New("no pepper")

ErrNoPepper is returned if no pepper is provided

Functions

This section is empty.

Types

type Base

type Base struct {
	UID        uuid.UUID      `json:"UID" gorm:"type:uuid; primary_key; default:uuid_generate_v4()"`
	CreatedAt  time.Time      `json:"created_at" sql:"index"`
	UpdatedAt  time.Time      `json:"update_at"`
	DeletedAt  gorm.DeletedAt `json:"deleted_at" sql:"index"`
	ArchivedAt *time.Time     `json:"archived_at" sql:"index"`
}

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate intercepts before the in the database

func (*Base) BeforeSave

func (base *Base) BeforeSave(tx *gorm.DB) error

BeforeSave intercepts before the save in the database

type Identity

type Identity struct {
	// Metadata
	Base
	// Attributes
	Salutation                 string `json:"salutation"`
	FirstName                  string `json:"firstName"`
	LastName                   string `json:"lastName"`
	Email                      string `json:"email"`
	BackupEmail                string `json:"backupEmail"`
	Phone                      string `json:"phone"`
	BackupPhone                string `json:"backupPhone"`
	Salt                       []byte `json:"-" xml:"-"`
	Password                   []byte `json:"-" xml:"-"`
	AcceptConditionsAndPrivacy bool   `json:"acceptConditionsAndPrivacy" xml:"-"`
	Active                     bool   `json:"activated" xml:"-"`
	Cleared                    bool   `gorm:"default:0" json:"cleared" xml:"-"`
	Blocked                    bool   `gorm:"default:0" json:"blocked" xml:"-"`
}

func (*Identity) CheckPassword

func (obj *Identity) CheckPassword(pepper, password string) bool

CheckPassword checks the password for the identity

func (*Identity) SetNewPassword

func (obj *Identity) SetNewPassword(pepper, password string) (err error)

SetNewPassword sets a new password for the identity

func (*Identity) TableName

func (obj *Identity) TableName() string

type IdentityAdmin

type IdentityAdmin struct {
	// Metadata
	Base
	// Attributes
	IdentityUID uuid.UUID `gorm:"type:uuid; primary_key" json:"identityUID"`
}

func (*IdentityAdmin) TableName

func (obj *IdentityAdmin) TableName() string

type IdentityApiToken

type IdentityApiToken struct {
	// Metadata
	Base
	// Attributes
	IdentityUID    uuid.UUID `json:"identityUID" gorm:"type:uuid; primaryKey;"`
	TokenUID       uuid.UUID `json:"tokenUID" gorm:"type:uuid; primaryKey;"`
	Name           string    `json:"name"`
	Token          string    `json:"token"`
	ExpirationDate time.Time `json:"expirationDate"`
}

func (*IdentityApiToken) TableName

func (obj *IdentityApiToken) TableName() string

type IdentityEmailChange

type IdentityEmailChange struct {
	Base
	// Relations
	IdentityUID uuid.UUID `gorm:"type:uuid;index" json:"identityUID"`
	// Attributes
	ExpiredAt             time.Time  `gorm:"index" json:"expiredAt"`
	ConfirmedOldAt        *time.Time `json:"confirmedOldAt"`
	ConfirmedNewAt        *time.Time `json:"confirmedNewAt"`
	ConfirmationOldClient string     `json:"confirmationOldClient"`
	ConfirmationOldIP     string     `json:"confirmationOldIP"`
	ConfirmationNewClient string     `json:"confirmationNewClient"`
	ConfirmationNewIP     string     `json:"confirmationNewIP"`
}

func (*IdentityEmailChange) TableName

func (obj *IdentityEmailChange) TableName() string

type IdentityLogin

type IdentityLogin struct {
	Base
	// Relations
	IdentityUID *uuid.UUID `gorm:"type:uuid;index" json:"identityUID"`
	// Attributes
	Email     string `json:"email"`
	UserAgent string `json:"userAgent"`
	IP        string `json:"ip"`
	Origin    string `json:"origin"`
}

func (*IdentityLogin) TableName

func (obj *IdentityLogin) TableName() string

type IdentityRegistrationConfirmation

type IdentityRegistrationConfirmation struct {
	Base
	// Relations
	IdentityUID uuid.UUID `gorm:"type:uuid;index" json:"identityUID"`
	// Attributes
	Token                 string     `json:"token" gorm:"unique;index"`
	RegistrationUserAgent string     `json:"registrationUserAgent"`
	RegistrationIP        string     `json:"registrationIP"`
	ConfirmationUserAgent string     `json:"confirmationUserAgent"`
	ConfirmationIP        string     `json:"confirmationIP"`
	ExpiredAt             time.Time  `json:"expiredAt"`
	ConfirmedAt           *time.Time `json:"confirmedAt"`
}

func (*IdentityRegistrationConfirmation) TableName

func (obj *IdentityRegistrationConfirmation) TableName() string

type IdentityRelation

type IdentityRelation struct {
	// Metadata
	Base
	// Attributes
	IdentityUID  uuid.UUID `gorm:"type:uuid; primary_key" json:"identityUID"`
	RelationType string    `gorm:"primary_key" json:"relationType"`
	EntityType   string    `gorm:"primary_key" json:"entityType"`
	EntityUID    uuid.UUID `gorm:"type:uuid; primary_key" json:"entityUID"`
}

func (*IdentityRelation) TableName

func (obj *IdentityRelation) TableName() string

type IdentityRelationEntity

type IdentityRelationEntity interface {
	GetEntityType() string
	GetEntityUID() uuid.UUID
}

type IdentityResetPassword

type IdentityResetPassword struct {
	// Metadata
	Base
	// Relations
	IdentityUID uuid.UUID `gorm:"type:uuid;index" json:"identityUID"`
	// Attributes
	Email                 string     `json:"email"`
	UserAgent             string     `json:"userAgent"`
	IP                    string     `json:"ip"`
	Origin                string     `json:"origin"`
	Expire                time.Time  `json:"expire"`
	Token                 string     `json:"token" gorm:"unique;index"`
	ConfirmationTime      *time.Time `json:"confirmationTime"`
	ConfirmationUserAgent string     `json:"confirmationUserAgent"`
	ConfirmationIP        string     `json:"confirmationIp"`
	ConfirmationOrigin    string     `json:"confirmationOrigin"`
}

func (*IdentityResetPassword) TableName

func (obj *IdentityResetPassword) TableName() string

type IdentityTokenMeta

type IdentityTokenMeta struct {
	// Metadata
	Base
	// Attributes
	TokenUID  uuid.UUID `gorm:"type:uuid;index" json:"tokenUID"`
	TokenType TokenType `json:"tokenType"`
}

func (*IdentityTokenMeta) TableName

func (obj *IdentityTokenMeta) TableName() string

type TokenType

type TokenType string

TokenType is the type of the token

const (
	LoginToken    TokenType = "LOGIN"
	ApiToken      TokenType = "API"
	PasswordReset TokenType = "PW_RESET"
)

Jump to

Keyboard shortcuts

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