SecurityToken

package
v0.0.0-...-6947385 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecurityToken

type SecurityToken struct {
	Id        Type.GormUlid                       `json:"id" gorm:"primaryKey;size:26;not null"`
	Crypto    Crypto.Crypto                       `json:"crypto" gorm:"size:64;not null"`
	Type      SecurityTokenType.SecurityTokenType `json:"type" gorm:"size:10;not null"`
	UserId    Type.GormUlid                       `json:"-"`
	User      User.User                           `json:"user" gorm:"foreignKey:UserId;references:Id;constraint:OnDelete:CASCADE"`
	CreatedAt time.Time                           `json:"created_at" gorm:"not null"`
	ExpiresAt time.Time                           `json:"expires_at" gorm:"not null"`
}

func GenerateRefresh

func GenerateRefresh(id ulid.ULID, user User.User, expiresAt time.Time) *SecurityToken

func GenerateReset

func GenerateReset(id ulid.ULID, user User.User, expiresAt time.Time) *SecurityToken

func (*SecurityToken) IsExpired

func (s *SecurityToken) IsExpired() bool

type SecurityTokenRepository

type SecurityTokenRepository interface {
	GetById(id ulid.ULID) (*SecurityToken, error)
	GetByCrypto(crypto Crypto.Crypto) (*SecurityToken, error)
	GetAllForUser(user User.User) (*[]SecurityToken, error)
	Add(securityToken *SecurityToken) error
	Remove(securityToken *SecurityToken) error
	UpdateOrAdd(securityToken *SecurityToken) error
	ClearExpiredTokens() error
}

Jump to

Keyboard shortcuts

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