oauth

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Lekko CLI client ID. Used for oauth with lekko.
	LekkoClientID string = "v0.303976a05d96c02eee5b1a75a3923815d82599b0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCredentials

type AuthCredentials struct {
	// OAuth token to be used in rpcs to Lekko.
	Token string
	// Optional team that the user is a member of and is currently operating on
	Team *string
}

type DeviceFlow

type DeviceFlow struct {
	// contains filtered or unexported fields
}

DeviceFlow initiates the OAuth 2.0 device authorization flow with Lekko.

func NewDeviceFlow

func NewDeviceFlow(lekkoURL string) *DeviceFlow

func (*DeviceFlow) Authorize

func (f *DeviceFlow) Authorize(ctx context.Context) (*AuthCredentials, error)

type OAuth

type OAuth struct {
	// contains filtered or unexported fields
}

OAuth is responsible for managing all of the authentication credentials and settings on the CLI.

func NewOAuth

Returns an OAuth object, responsible for managing oauth on the local FS. This is meant to be used by the cli on the user's local filesystem.

func (*OAuth) ConfirmForgotPassword added in v0.2.18

func (a *OAuth) ConfirmForgotPassword(
	ctx context.Context, email string, newPassword string, confirmNewPassword string, verificationCode string,
) error

func (*OAuth) ConfirmUser added in v0.2.14

func (a *OAuth) ConfirmUser(ctx context.Context, username, code string) error

func (*OAuth) ForgotPassword added in v0.2.18

func (a *OAuth) ForgotPassword(ctx context.Context, email string) error

func (*OAuth) Login

func (a *OAuth) Login(ctx context.Context, ws secrets.WriteSecrets) error

Login will attempt to read any existing lekko and github credentials from disk. If either of those credentials don't exist, or are expired, we will reinitiate oauath with that provider.

func (*OAuth) Logout

func (a *OAuth) Logout(ctx context.Context, provider string, ws secrets.WriteSecrets) error

Logout implicitly expires the relevant credentials by deleting them. TODO: explore explicitly expiring these credentials with each provider.

func (*OAuth) Register

func (a *OAuth) Register(ctx context.Context, username, password, confirmPassword string) error

func (*OAuth) ResendVerification added in v0.2.18

func (a *OAuth) ResendVerification(ctx context.Context, email string) error

func (*OAuth) Status

func (a *OAuth) Status(ctx context.Context, skipAuthCheck bool, rs secrets.ReadSecrets)

Status reads existing credentials and prints them out in stdout.

func (*OAuth) Tokens

func (a *OAuth) Tokens(ctx context.Context, rs secrets.ReadSecrets) []string

Jump to

Keyboard shortcuts

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