Documentation ¶
Index ¶
- Constants
- Variables
- func AccountLoaderFunc(ctx context.Context, key string) (interface{}, error)
- func UpdateAccount(ctx context.Context, account *Account) error
- type Account
- func CreateAccount(ctx context.Context, realm, userID string, expires int) (*Account, error)
- func DeleteAccount(ctx context.Context, realm, clientID string) (*Account, error)
- func FindAccountByToken(ctx context.Context, token string) (*Account, error)
- func FindAccountByUserID(ctx context.Context, realm, userID string) (*Account, error)
- func LookupAccount(ctx context.Context, realm, clientID string) (*Account, error)
- func ResetAccountChallenge(ctx context.Context, acc *Account, expires int) (*Account, error)
- func ResetTemporaryToken(ctx context.Context, acc *Account, expires int) (*Account, error)
Constants ¶
View Source
const ( // AccountActive indicates a confirmed account with a valid login & authorization AccountActive = 1 // AccountLoggedOut indicates a confirmed account that is not logged in AccountLoggedOut = 0 // AccountDeactivated indicates an account that has been deactivated due to e.g. account deletion or UserID swap AccountDeactivated = -1 // AccountBlocked signals an issue with the account that needs intervention AccountBlocked = -2 // AccountUnconfirmed well guess what? AccountUnconfirmed = -3 )
Variables ¶
View Source
var ( // ErrAccountExists indicates that the account already exists and can't be created ErrAccountExists = errors.New("account exists") // ErrNoSuchAccount indicates that the account does not exist ErrNoSuchAccount = errors.New("no such account") )
Functions ¶
func AccountLoaderFunc ¶ added in v2.5.0
AccountLoaderFunc implements the LoaderFunc interface for retrieving account resources
Types ¶
type Account ¶
type Account struct { Realm string `json:"realm"` // KEY UserID string `json:"user_id"` // KEY external id for the entity e.g. email for a user ClientID string `json:"client_id"` // a unique id within [realm,user_id] // status and other metadata Status int `json:"status"` // default == AccountUnconfirmed // login auditing LastLogin int64 `json:"-"` LoginCount int `json:"-"` LoginFrom string `json:"-"` // internal Token string `json:"-"` // a temporary token to confirm the account or to exchanged for the "real" token Expires int64 `json:"-"` // 0 == never Confirmed int64 `json:"-"` Created int64 `json:"-"` Updated int64 `json:"-"` }
Account represents an account for a user or client (e.g. API, bot)
func CreateAccount ¶
CreateAccount creates an new account in the given realm. userID has to be unique and a new clientID will be assigned.
func DeleteAccount ¶ added in v2.5.0
func FindAccountByToken ¶
FindAccountByToken retrieves an account bases on either the temporary token or the auth token
func FindAccountByUserID ¶
FindAccountUserID retrieves an account bases on the user id
func LookupAccount ¶
LookupAccount retrieves an account within a given realm
func ResetAccountChallenge ¶
ResetAccountChallenge creates a new confirmation token and resets the timer
func ResetTemporaryToken ¶ added in v2.4.0
ResetTemporaryToken creates a new temporary token and resets the timer
Click to show internal directories.
Click to hide internal directories.