Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
Click to show internal directories.
Click to hide internal directories.