login

package
v0.0.0-...-c37676c Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullCommand

func FullCommand() string

FullCommand will command line string

func RunLogin

func RunLogin() error

RunLogin will start a ODIC dance with the provider

Types

type LoginAgent

type LoginAgent struct {
	// Whether to execute OpenBrowser when authenticating the user.
	SkipBrowser bool

	// Read input from here; if nil, uses os.Stdin.
	In io.Reader

	// Write output to here; if nil, uses os.Stdout.
	Out io.Writer

	// Open the browser for the given url.  If nil, uses webbrowser.Open.
	OpenBrowser func(url string) error

	// OIDC Client id/secret
	ClientID     string
	ClientSecret string
	Audience     string

	Endpoint   oauth2.Endpoint
	ExtraScope []string
}

LoginAgent implements the OAuth2 login dance, generating an Oauth2 access_token for the user. If AllowBrowser is set to true, the agent will attempt to obtain an authorization_code automatically by executing OpenBrowser and reading the redirect performed after a successful login. Otherwise, it will attempt to use In and Out to direct the user to the login portal and receive the authorization_code in response.

func (*LoginAgent) PerformLogin

func (a *LoginAgent) PerformLogin(callbackPort int) (oauth2.TokenSource, error)

PerformLogin performs the auth dance necessary to obtain an authorization_code from the user and exchange it for an Oauth2 access_token.

Jump to

Keyboard shortcuts

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