account

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

package account provides the structure for and account and some utility code related to the storage of Account objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound takens an arbitrary error and determines whether or not the error indicates that the Account was not found.

Types

type Account

type Account struct {
	Name     string    // The account name
	AuthType string    // The identifier for the mechanism by which the user's password is transformed and compared
	AuthData []byte    // The authentication token, managed by the authentication mechanism
	Locked   bool      // Whether or not the account is administratively locked
	Expires  time.Time // The date and time after which the AuthData is expired
	AuxData  []byte    // Arbitrary data the application stores with the Account
}

Account represents an account within the application. Account names should be unique. The application should not directly modify AuthType, AuthData, or Expires.

type NotFound

type NotFound interface {
	IsNotFound() bool
}

NotFound can be implemented by errors in store packages to indicate that an account is not found.

type NotFoundError

type NotFoundError struct {
	Str string
}

NotFoundError is a general purpose error that indicates that an Account is not found.

func (NotFoundError) Error

func (nfe NotFoundError) Error() string

Error returns the string representation of the error.

func (NotFoundError) IsNotFound

func (nfe NotFoundError) IsNotFound() bool

IsNotFound indicates whether or not an Account was not found.

func (NotFoundError) String

func (nfe NotFoundError) String() string

String returns the string representation of the error.

type Store

type Store interface {
	Get(name string) (*Account, error)       // Retrieve an Account by name
	Update(a *Account) error                 // Update the internal representation of an Account
	Flush() error                            // Flush any changes to Account objects to storage
	Delete(name string) error                // Remove an Account from storage
	Rename(newname string, a *Account) error // Renames an account to the new name, replacing an existing Account and modifying the Account object to have the new name.
}

Store collects the methods required of an underlying Account store.

Directories

Path Synopsis
package json provides Account storage in a simple, single JSON file.
package json provides Account storage in a simple, single JSON file.

Jump to

Keyboard shortcuts

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