auth

package
v0.1.1-0...-fa1080e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOGIN_PATH = "/login"
)

Variables

View Source
var (
	ErrEmptyToken = errors.New("auth: You must be logged in. Please use `gemnasium auth login` first, or pass your api token with --token or GEMNASIUM_TOKEN")
)

Error codes returned by auth failures

Functions

func ConfigureAPIToken

func ConfigureAPIToken(ctx *cli.Context) error

Try to get credential from 3 sources (in that exact order): - from netrc file - local config file (ie: .gemnasium.yml), with a `api_key` yaml key - from command line flag `token`

Each source will override previous one (token flag has priority above all).

WARNING: Directly exit the programm in case of error

func Login

func Login() error

Login with the user email and password An entry will be created in ~/.netrc on successful login.

func LoginWithAPIToken

func LoginWithAPIToken(token string) (err error)

Login with the user email and API token An entry will be created in ~/.netrc on successful login.

func Logout

func Logout() error

Logout doesn't hit the API of course. It simply removes the corresponding entry in ~/.netrc

Types

This section is empty.

Jump to

Keyboard shortcuts

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