credentialhelper

package
v2.1.155 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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