auth

package
v0.0.0-...-23b4524 Latest Latest
Warning

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

Go to latest
Published: May 16, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//BucketName is the name of the bucket created in the bolt database
	//to store authentication information. The BucketName is prepended to the
	//uri of the SecurityCenter instance.
	BucketName = "AuthBucket"
	//DB is the name of the bolt database file
	DB = "auth.db"
	//ETC is the Estimated Time to Complete session (e.g. how long until session self-destructs)
	ETC = 60 * time.Minute
)

Variables

This section is empty.

Functions

func Delete

func Delete(c *cli.Context) error

Delete will purge the local bolt database. Note this does not invalidate the session from SecurityCenter incase the currently used token is being used elsewhere. An option for also invalidating the session may be present in future iteration(s).

func Do

func Do(c *cli.Context)

Do begins the interactive login process

func Get

func Get(c *cli.Context) (map[string]string, error)

Get returns the current token and sesion information for the current session if present. First, it will look at the flags passed to the binary at runtime (e.g. --token and --session). If those don't exist, it will look in the local bolt database file (auth.db).

func Set

func Set(c *cli.Context, keys map[string]string)

Set sets the session information based on the supplied `keys` map. These values are transalted as a key-value pair and are saved accordingly to the local auth.db bolt database file. On save, it sets the current `__timestamp` field to auto invalidate the session after a specified time.

func Test

func Test(c *cli.Context) (ok bool)

Test tests the current authentication information by making a simple request to the configured SecurityCenter instance. If the user is successfully authenticated, they will be greeted with their username and fullname while the function returns `true`. If not, they are shown an error and the function returns false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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