auth

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package auth provides common authentication tools NOTE: Subject to change, do not rely on this package from outside git-lfs source

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOperationForRequest

func GetOperationForRequest(req *http.Request) string

GetOperationForRequest determines the operation type for a http.Request

func SaveCredentials

func SaveCredentials(cfg *config.Configuration, creds Creds, res *http.Response)

Types

type CredentialFunc

type CredentialFunc func(*config.Configuration, Creds, string) (Creds, error)

Credentials function which will be called whenever credentials are requested

func GetCredentialsFunc

func GetCredentialsFunc() CredentialFunc

GetCredentialsFunc returns the current credentials function

func SetCredentialsFunc

func SetCredentialsFunc(f CredentialFunc) CredentialFunc

SetCredentialsFunc overrides the default credentials function (which is to call git) Returns the previous credentials func

type Creds

type Creds map[string]string

func GetCreds

func GetCreds(cfg *config.Configuration, req *http.Request) (Creds, error)

getCreds gets the credentials for a HTTP request and sets the given request's Authorization header with them using Basic Authentication.

  1. Check the URL for authentication. Ex: http://user:pass@example.com
  2. Check netrc for authentication.
  3. Check the Git remote URL for authentication IF it's the same scheme and host of the URL.
  4. Ask 'git credential' to fill in the password from one of the above URLs.

This prefers the Git remote URL for checking credentials so that users only have to enter their passwords once for Git and Git LFS. It uses the same URL path that Git does, in case 'useHttpPath' is enabled in the Git config.

func (Creds) Buffer

func (c Creds) Buffer() *bytes.Buffer

type SshAuthResponse

type SshAuthResponse struct {
	Message   string            `json:"-"`
	Href      string            `json:"href"`
	Header    map[string]string `json:"header"`
	ExpiresAt string            `json:"expires_at"`
}

func SshAuthenticate

func SshAuthenticate(cfg *config.Configuration, operation, oid string) (SshAuthResponse, config.Endpoint, error)

Jump to

Keyboard shortcuts

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