browserauth

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Credentials       *session.StoredCredentials // Profile which is being authenticated
	Host              string                     // The address to which the local callback is bound
	Port              int                        // The port to which the local callback is bound
	AuthenticationURL string                     // URL where the user should be redirected
	// contains filtered or unexported fields
}

Browser-based authentication callback handler. When using browser-based authentication, the user is given a link to follow which handles authentication w/ spacelift.io. Afterwards, the user is redirected to a page hosted on localhost which receives an encrypted API token. This type will handle the local authentication callback, and store the token in the given profile after completion. This helper package does not save the profile after updating the token. The caller of this package should call manager.Create(profile) to save the updated profile if a new valid token was received.

func Begin

func Begin(credentials *session.StoredCredentials) (*Handler, error)

func BeginWithBindAddress

func BeginWithBindAddress(credentials *session.StoredCredentials, host string, port int) (*Handler, error)

func (*Handler) Cancel

func (h *Handler) Cancel()

func (*Handler) Wait

func (h *Handler) Wait(ctx context.Context) error

Wait for a token to be received via the local callback endpoint or the given context to expire. If no error is returned here, you should have a token in profile.Credentials.AccessToken.

Jump to

Keyboard shortcuts

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