auth

package
v0.0.0-...-493bf59 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 13 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IAuth

type IAuth interface {
	Signin() (*models.User, error)
	Signout() error
	Verify() (*models.User, error)
}

IAuth represents the contract that concrete implementations should follow when implementing authentication.

func New

func New(settings *models.Settings, prompts prompts.IPrompts) IAuth

type SAuth

type SAuth struct {
	Settings *models.Settings
	Prompts  prompts.IPrompts
}

SAuth is a concrete implementation of IAuth

func (*SAuth) Signin

func (a *SAuth) Signin() (*models.User, error)

Signin signs in a user and returns the representative user model. If an error occurs, nil is returned for the user and the error field is populated.

func (*SAuth) Signout

func (a *SAuth) Signout() error

Signout signs out a user by their session token.

func (*SAuth) Verify

func (a *SAuth) Verify() (*models.User, error)

Verify verifies if a given session token is still valid or not. If it is valid, the returned error will be nil.

Jump to

Keyboard shortcuts

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