session

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const EnvManifoldEmail string = "MANIFOLD_EMAIL"

EnvManifoldEmail describes the environment variable name used to reference a Manifold login email

View Source
const EnvManifoldPass string = "MANIFOLD_PASS"

EnvManifoldPass describes the environment variable name used to reference a Manifold login password

View Source
const EnvManifoldToken string = "MANIFOLD_API_TOKEN"

EnvManifoldToken describes the environment variable name used to reference a Manifold api token

View Source
const EnvManifoldTokenLen int = 60

EnvManifoldTokenLen specifies the character length of a token

Variables

This section is empty.

Functions

func Destroy

func Destroy(ctx context.Context, cfg *config.Config) error

Destroy the session by invalidating the token through the Manifold API and clearing the local auth token cache

func Signup

func Signup(ctx context.Context, cfg *config.Config, name, email, password string) (*models.User, error)

Signup makes a request to create a new account

Types

type Authorized

type Authorized struct {
	// contains filtered or unexported fields
}

Authorized struct to represent an authorized user session

func (*Authorized) Authenticated

func (a *Authorized) Authenticated() bool

Authenticated returns if the session is authenticated or not, in this case

true

func (*Authorized) FromEnvVars

func (a *Authorized) FromEnvVars() bool

FromEnvVars returns if the session was recently authenticated from environment login variablesor not

func (*Authorized) IsUser added in v0.8.1

func (a *Authorized) IsUser() bool

IsUser returns true if the authenticated session is based on a user

func (*Authorized) LabelInfo

func (a *Authorized) LabelInfo() *[]string

LabelInfo returns information used in selects for this user

func (*Authorized) User

func (a *Authorized) User() *models.User

User returns the user object associated with this session, in this case nil

type Session

type Session interface {
	Authenticated() bool
	FromEnvVars() bool
	User() *models.User
	IsUser() bool
	LabelInfo() *[]string
}

Session interface to describe user session and authentication with Manifold

API

func Create

func Create(ctx context.Context, cfg *config.Config, email,
	password string) (Session, error)

Create a new session with the Manifold API based on the provided credentials

func Retrieve

func Retrieve(ctx context.Context, cfg *config.Config) (Session, error)

Retrieve a session struct from the Manifold API based on the auth token in

the config

type Unauthorized

type Unauthorized struct{}

Unauthorized struct to represent an unauthorized user session

func (*Unauthorized) Authenticated

func (*Unauthorized) Authenticated() bool

Authenticated returns if the session is authenticated or not, in this case false

func (*Unauthorized) FromEnvVars

func (*Unauthorized) FromEnvVars() bool

FromEnvVars returns if the session was recently authenticated from environment login variablesor not, in this case false

func (*Unauthorized) IsUser added in v0.8.1

func (*Unauthorized) IsUser() bool

IsUser returns true if the authenticated session is based on a user

func (*Unauthorized) LabelInfo

func (*Unauthorized) LabelInfo() *[]string

LabelInfo returns information used in selects for this user

func (*Unauthorized) User

func (*Unauthorized) User() *models.User

User returns the user object associated with this session, in this case nil

Jump to

Keyboard shortcuts

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