users

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemDB

type InMemDB struct {
	Users map[string]User
}

InMemDB : A generic in memory database

var DB *InMemDB

DB : The in memory database instance

func (*InMemDB) AddRememberToken

func (db *InMemDB) AddRememberToken(_ context.Context, pid, t string) error

AddRememberToken to a user

func (*InMemDB) Create

func (db *InMemDB) Create(_ context.Context, u authboss.User) error

Create and save the user

func (*InMemDB) DelRememberTokens

func (db *InMemDB) DelRememberTokens(_ context.Context, pid string) error

DelRememberTokens removes all tokens for the given pid

func (*InMemDB) Load

func (db *InMemDB) Load(_ context.Context, id string) (authboss.User, error)

Load the user

func (*InMemDB) LoadByConfirmSelector

func (db *InMemDB) LoadByConfirmSelector(_ context.Context, selector string) (user authboss.ConfirmableUser, err error)

LoadByConfirmSelector looks a user up by confirmation token

func (*InMemDB) LoadByRecoverSelector

func (db *InMemDB) LoadByRecoverSelector(_ context.Context, selector string) (user authboss.RecoverableUser, err error)

LoadByRecoverSelector looks a user up by confirmation selector

func (*InMemDB) New

func (db *InMemDB) New(_ context.Context) authboss.User

New user creation; the user not saved

func (*InMemDB) Save

func (db *InMemDB) Save(_ context.Context, u authboss.User) error

Save the user

func (*InMemDB) UseRememberToken

func (db *InMemDB) UseRememberToken(_ context.Context, pid, token string) error

UseRememberToken finds the pid-token pair and deletes it. ie: the user uses the remember token, so it is now invalid If the token could not be found return ErrTokenNotFound

type User

type User struct {
	ID   string
	Name string

	// Authable
	Email    string
	Password string

	// Recoverable
	RecoverSelector    string
	RecoverVerifier    string
	RecoverTokenExpiry time.Time

	// Confirmable
	ConfirmSelector string
	ConfirmVerifier string
	Confirmed       bool

	// Lockable
	AttemptCount int
	LastAttempt  time.Time
	Locked       time.Time

	// OAuthable
	OAuth2UID          string
	OAuth2Provider     string
	OAuth2AccessToken  string
	OAuth2RefreshToken string
	OAuth2Expiry       time.Time

	// Rememberable
	RememberTokens []string
}

User database model

func (User) GetArbitrary

func (u User) GetArbitrary() map[string]string

GetArbitrary data from user

func (User) GetAttemptCount

func (u User) GetAttemptCount() int

GetAttemptCount from user

func (User) GetConfirmSelector

func (u User) GetConfirmSelector() string

GetConfirmSelector from user

func (User) GetConfirmVerifier

func (u User) GetConfirmVerifier() string

GetConfirmVerifier from user

func (User) GetConfirmed

func (u User) GetConfirmed() bool

GetConfirmed from user

func (User) GetEmail

func (u User) GetEmail() string

GetEmail from user

func (User) GetLastAttempt

func (u User) GetLastAttempt() time.Time

GetLastAttempt from user

func (User) GetLocked

func (u User) GetLocked() time.Time

GetLocked from user

func (User) GetOAuth2AccessToken

func (u User) GetOAuth2AccessToken() (token string)

GetOAuth2AccessToken from user

func (User) GetOAuth2Expiry

func (u User) GetOAuth2Expiry() (expiry time.Time)

GetOAuth2Expiry from user

func (User) GetOAuth2Provider

func (u User) GetOAuth2Provider() (provider string)

GetOAuth2Provider from user

func (User) GetOAuth2RefreshToken

func (u User) GetOAuth2RefreshToken() (refreshToken string)

GetOAuth2RefreshToken from user

func (User) GetOAuth2UID

func (u User) GetOAuth2UID() (uid string)

GetOAuth2UID from user

func (User) GetPID

func (u User) GetPID() string

GetPID from user

func (User) GetPassword

func (u User) GetPassword() string

GetPassword from user

func (User) GetRecoverExpiry

func (u User) GetRecoverExpiry() time.Time

GetRecoverExpiry from user

func (User) GetRecoverSelector

func (u User) GetRecoverSelector() string

GetRecoverSelector from user

func (User) GetRecoverVerifier

func (u User) GetRecoverVerifier() string

GetRecoverVerifier from user

func (User) IsOAuth2User

func (u User) IsOAuth2User() bool

IsOAuth2User returns true if the user was created with oauth2

func (*User) PutArbitrary

func (u *User) PutArbitrary(values map[string]string)

PutArbitrary data from user

func (*User) PutAttemptCount

func (u *User) PutAttemptCount(attempts int)

PutAttemptCount into user

func (*User) PutConfirmSelector

func (u *User) PutConfirmSelector(confirmSelector string)

PutConfirmSelector into user

func (*User) PutConfirmVerifier

func (u *User) PutConfirmVerifier(confirmVerifier string)

PutConfirmVerifier into user

func (*User) PutConfirmed

func (u *User) PutConfirmed(confirmed bool)

PutConfirmed into user

func (*User) PutEmail

func (u *User) PutEmail(email string)

PutEmail into user

func (*User) PutLastAttempt

func (u *User) PutLastAttempt(last time.Time)

PutLastAttempt into user

func (*User) PutLocked

func (u *User) PutLocked(locked time.Time)

PutLocked into user

func (*User) PutOAuth2AccessToken

func (u *User) PutOAuth2AccessToken(token string)

PutOAuth2AccessToken into user

func (*User) PutOAuth2Expiry

func (u *User) PutOAuth2Expiry(expiry time.Time)

PutOAuth2Expiry into user

func (*User) PutOAuth2Provider

func (u *User) PutOAuth2Provider(provider string)

PutOAuth2Provider into user

func (*User) PutOAuth2RefreshToken

func (u *User) PutOAuth2RefreshToken(refreshToken string)

PutOAuth2RefreshToken into user

func (*User) PutOAuth2UID

func (u *User) PutOAuth2UID(uid string)

PutOAuth2UID into user

func (*User) PutPID

func (u *User) PutPID(pid string)

PutPID into user

func (*User) PutPassword

func (u *User) PutPassword(password string)

PutPassword into user

func (*User) PutRecoverExpiry

func (u *User) PutRecoverExpiry(expiry time.Time)

PutRecoverExpiry into user

func (*User) PutRecoverSelector

func (u *User) PutRecoverSelector(token string)

PutRecoverSelector into user

func (*User) PutRecoverVerifier

func (u *User) PutRecoverVerifier(token string)

PutRecoverVerifier into user

Jump to

Keyboard shortcuts

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