gitauth

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCommand

func CheckCommand(args, env []string) bool

CheckCommand returns true if the command arguments and environment match those when the GIT_ASKPASS command is invoked by git.

func OverrideVSCodeConfigs

func OverrideVSCodeConfigs(fs afero.Fs) error

OverrideVSCodeConfigs overwrites a few properties to consume GIT_ASKPASS from the host instead of VS Code-specific authentication.

func ParseAskpass

func ParseAskpass(prompt string) (user string, host string, err error)

ParseAskpass returns the user and host from a git askpass prompt. For example: "user1" and "https://github.com". Note that for HTTP protocols, the URL will never contain a path.

For details on how the prompt is formatted, see `credential_ask_one`: https://github.com/git/git/blob/bbe21b64a08f89475d8a3818e20c111378daa621/credential.c#L173-L191

Types

type Config

type Config struct {
	httpmw.OAuth2Config
	// ID is a unique identifier for the authenticator.
	ID string
	// Regex is a regexp that URLs will match against.
	Regex *regexp.Regexp
	// Type is the type of provider.
	Type codersdk.GitProvider
	// NoRefresh stops Coder from using the refresh token
	// to renew the access token.
	//
	// Some organizations have security policies that require
	// re-authentication for every token.
	NoRefresh bool
	// ValidateURL ensures an access token is valid before
	// returning it to the user. If omitted, tokens will
	// not be validated before being returned.
	ValidateURL string
}

Config is used for authentication for Git operations.

func ConvertConfig

func ConvertConfig(entries []codersdk.GitAuthConfig, accessURL *url.URL) ([]*Config, error)

ConvertConfig converts the YAML configuration entry to the parsed and ready-to-consume provider type.

Jump to

Keyboard shortcuts

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