auth

package
v0.0.0-...-fcf6678 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package auth implements common functionality to authenticate reclient against GCP.

Index

Constants

View Source
const (
	// ExitCodeNoAuth is the exit code when no auth option is specified.
	ExitCodeNoAuth = 14
	// ExitCodeCredsFileAuth is the exit code when there is a failure to authenticate using a credentials file.
	ExitCodeCredsFileAuth = 13
	// ExitCodeGCECredsAuth is the exit code when there is a failure in GCE credentials.
	ExitCodeGCECredsAuth = 12
	// ExitCodeExternalTokenAuth is the exit code when there is a failure to authenticate with an external token.
	ExitCodeExternalTokenAuth = 11
	// ExitCodeAppDefCredsAuth is the exit code when there is a failure to authenticate with ADC.
	ExitCodeAppDefCredsAuth = 10
	// ExitCodeUnknown is the exit code when there is an unknown auth issue.
	ExitCodeUnknown = 19
)

Exit codes to indicate various causes of authentication failure.

View Source
const (
	// UseAppDefaultCredsFlag is used to authenticate with application default credentials.
	UseAppDefaultCredsFlag = "use_application_default_credentials"
	// UseExternalTokenFlag indicates the user will authenticate with a provided token.
	UseExternalTokenFlag = "use_external_auth_token"
	// UseGCECredsFlag indicates the user will authenticate with GCE VM credentials.
	UseGCECredsFlag = "use_gce_credentials"
	// ServiceNoAuthFlag indicates the user will not use authentication
	ServiceNoAuthFlag = "service_no_auth"
	// CredentialFileFlag indicates the user authenticate with a credential file
	CredentialFileFlag = "credential_file"
)

Variables

This section is empty.

Functions

func UpdateStatus

func UpdateStatus(m Mechanism) (int, error)

UpdateStatus updates ADC credentials status if expired

Types

type Error

type Error struct {

	// ExitCode is the exit code for the error.
	ExitCode int
	// contains filtered or unexported fields
}

Error is an error occured during authenticating or initializing credentials.

type Mechanism

type Mechanism int

Mechanism is a mechanism of authentication to the remote execution service.

const (
	// Unknown is an unknown auth mechanism.
	Unknown Mechanism = iota

	// ADC is GCP's application default credentials authentication mechanism.
	ADC
	// GCE is authentication using GCE VM service accounts.
	GCE
	// CredentialFile is using service account credentials from a proviced file
	CredentialFile
	// None implies that the user will not use authentication
	None
)

func MechanismFromFlags

func MechanismFromFlags() (Mechanism, error)

MechanismFromFlags returns an auth Mechanism based on flags currently set.

func (Mechanism) String

func (m Mechanism) String() string

String returns the string representation of the auth mechanism.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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