Documentation ¶
Index ¶
- Constants
- func GenerateRandomString(n int) string
- func IsValid(tagName string, model interface{}) bool
- type Action
- type Client
- type Language
- type Model
- type Session
- type Tokens
- type User
- func (user *User) Authentic(password, passcode string) bool
- func (user *User) BeforeCreate(scope *gorm.Scope) error
- func (user *User) BeforeSave(scope *gorm.Scope) error
- func (user *User) GenerateCodeSecret() *otp.Key
- func (user *User) GenerateRecoverSecret() string
- func (user *User) UpdatePassword(password string) error
Constants ¶
View Source
const ( PublicClient string = "public" ConfidentialClient string = "confidential" )
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomString ¶
Types ¶
type Action ¶
type Action struct { UUID string `validate:"omitempty,uuid4" json:"uuid"` User User `validate:"exists" json:"-"` UserID uint `json:"user_id"` Client Client `validate:"exists" json:"-"` ClientID uint `json:"client_id"` Moment int64 `json:"moment"` ExpiresIn int64 `json:"expires_in"` Ip string `validate:"required" json:"ip"` UserAgent string `validate:"required" json:"user_agent"` Token string `validate:"omitempty,alphanum" json:"token"` Scopes string `validate:"required,scope" json:"scopes"` CreatedAt time.Time `json:"created_at"` }
func RetrieveActionByToken ¶
func RetrieveActionByUUID ¶
func (*Action) WithinExpirationWindow ¶
type Client ¶
type Client struct { Model UUID string `gorm:"not null;unique;index" validate:"omitempty,uuid4" json:"id"` Name string `gorm:"not null;unique;index" validate:"required,min=3,max=20" json:"name"` Description string `json:"description"` Key string `gorm:"not null;unique;index" json:"-"` Secret string `gorm:"not null" validate:"required" json:"-"` Scopes string `gorm:"not null" validate:"required" json:"-"` CanonicalURI string `gorm:"not null" validate:"required" json:"uri"` RedirectURI string `gorm:"not null" validate:"required" json:"-"` Type string `gorm:"not null" validate:"required,client" json:"-"` }
func (*Client) DefaultRedirectURI ¶
func (*Client) UpdateSecret ¶
type Session ¶
type Session struct { Model UUID string `gorm:"not null;unique;index" validate:"omitempty,uuid4" json:"-"` User User `gorm:"not null" validate:"exists" json:"-"` UserID uint `gorm:"not null" json:"-"` Client Client `gorm:"not null" validate:"exists" json:"-"` ClientID uint `gorm:"not null" json:"-"` Moment int64 `gorm:"not null" json:"moment"` ExpiresIn int64 `gorm:"not null;default:0" json:"expires_in"` Ip string `gorm:"not null;index" validate:"required" json:"-"` UserAgent string `gorm:"not null" validate:"required" json:"-"` Invalidated bool `gorm:"not null;default:false"` Token string `gorm:"not null;unique;index" validate:"omitempty,alphanum" json:"token"` TokenType string `gorm:"not null;index" validate:"required,token" json:"token_type"` Scopes string `gorm:"not null" validate:"required,scope" json:"-"` }
func (*Session) WithinExpirationWindow ¶
type User ¶
type User struct { Model UUID string `gorm:"not null;unique;index" validate:"omitempty,uuid4" json:"-"` PublicId string `gorm:"not null;unique;index" json:"public_id"` Username string `gorm:"not null;unique;index" validate:"required,alphanum,max=60" json:"-"` FirstName string `gorm:"not null" validate:"required,min=3,max=20" essential:"required,min=3,max=20" json:"first_name"` LastName string `gorm:"not null" validate:"required,min=3,max=20" essential:"required,min=3,max=20" json:"last_name"` Email string `gorm:"not null;unique;index" validate:"required,email" essential:"required,email" json:"email"` Passphrase string `gorm:"not null" validate:"required" essential:"required,min=10" json:"-"` Active bool `gorm:"not null;default:false" json:"active"` Admin bool `gorm:"not null;default:false" json:"-"` Client Client `gorm:"not null" validate:"exists" json:"-"` ClientID uint `gorm:"not null" json:"-"` Language Language `gorm:"not null" validate:"exists" json:"-"` LanguageID uint `gorm:"not null" json:"-"` TimezoneIdentifier string `gorm:"not null;default:'GMT'" json:"timezone_identifier"` CodeSecret string `gorm:"not null" validate:"required" json:"-"` RecoverSecret string `gorm:"not null" validate:"required" json:"-"` }
func (*User) GenerateCodeSecret ¶
func (*User) GenerateRecoverSecret ¶
func (*User) UpdatePassword ¶
Click to show internal directories.
Click to hide internal directories.