credentialhelper

package
v3.6.4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	XDG_CONFIG_HOME         = "XDG_CONFIG_HOME"
	GIT_SECRET_MOUNT_PATH   = "GIT_SECRET_MOUNT_PATH"
	GIT_SECRET_KEY_USER     = "GIT_SECRET_KEY_USER"
	GIT_SECRET_KEY_PASSWORD = "GIT_SECRET_KEY_PASSWORD"
	GIT_SECRET_SERVER       = "GIT_SECRET_SERVER"
)

Variables

This section is empty.

Functions

func WriteGitCredentialFromSecretMount added in v3.0.32

func WriteGitCredentialFromSecretMount() error

WriteGitCredentialFromSecretMount writes mounted kubernetes secret credentials to file $XDG_CONFIG_HOME/git/credentials see for more details https://git-scm.com/docs/git-credential-store

Types

type GitCredential

type GitCredential struct {
	Protocol string
	Host     string
	Path     string
	Username string
	Password string
}

GitCredential represents the different parts of a git credential URL See also https://git-scm.com/docs/git-credential

func CreateGitCredential

func CreateGitCredential(lines []string) (GitCredential, error)

CreateGitCredential creates a CreateGitCredential instance from a slice of strings where each element is a key/value pair separated by '='.

func CreateGitCredentialFromURL

func CreateGitCredentialFromURL(gitURL string, username string, password string) (GitCredential, error)

CreateGitCredentialFromURL creates a CreateGitCredential instance from a URL and optional username and password.

func (*GitCredential) Clone

func (g *GitCredential) Clone() GitCredential

Clone clones this GitCredential instance

func (*GitCredential) String

func (g *GitCredential) String() string

String returns a string representation of this instance according to the expected format of git credential helpers. See also https://git-scm.com/docs/git-credential

func (*GitCredential) URL

func (g *GitCredential) URL() (url.URL, error)

URL returns a URL from the data of this instance. If not enough information exist an error is returned

type GitCredentialsHelper

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

GitCredentialsHelper is used to implement the git credential helper algorithm. See also https://git-scm.com/docs/git-credential.

func CreateGitCredentialsHelper

func CreateGitCredentialsHelper(in io.Reader, out io.Writer, credentials []GitCredential) (*GitCredentialsHelper, error)

CreateGitCredentialsHelper creates an instance of a git credential helper. It needs to get passed the handles to read the git credential data as well as write the response to. It also gets the list og known credentials.

func (*GitCredentialsHelper) Fill

func (h *GitCredentialsHelper) Fill(queryCredential GitCredential) GitCredential

Fill creates a GitCredential instance based on a git credential helper request which represented by the passed queryCredential instance. If there is no auth information available an empty credential instance is returned

func (*GitCredentialsHelper) Get

func (h *GitCredentialsHelper) Get() error

Get implements the get operation of the git credential helper protocol. It reads the authentication query from the reader of this instance and writes the response to the writer (usually this will be stdout and stdin).

func (*GitCredentialsHelper) Run

func (h *GitCredentialsHelper) Run(op string) error

Run executes the specified git credential helper operation which must be one of get, store or erase. NOTE: Currently only get is implemented.

Jump to

Keyboard shortcuts

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