scmauth

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CACertName   = "ca.crt"
	CACertConfig = `# SSL cert
[http]
   sslCAInfo = %[1]s
`
)
View Source
const (
	DefaultUsername      = "builder"
	UsernamePasswordName = "password"
	UsernameSecret       = "username"
	PasswordSecret       = "password"
	TokenSecret          = "token"
	UserPassGitConfig    = `# credential git config
[credential]
   helper = store --file=%s
`
)
View Source
const GitConfigName = ".gitconfig"
View Source
const SSHPrivateKeyMethodName = "ssh-privatekey"

Variables

This section is empty.

Functions

This section is empty.

Types

type CACert added in v1.0.6

type CACert struct {
	SourceURL url.URL
}

CACert implements SCMAuth interface for using a custom certificate authority

func (CACert) Handles added in v1.0.6

func (_ CACert) Handles(name string) bool

Handles returns true if the secret is a CA certificate

func (CACert) Name added in v1.0.6

func (_ CACert) Name() string

Name returns the name of this auth method.

func (CACert) Setup added in v1.0.6

func (s CACert) Setup(baseDir string) (*url.URL, error)

Setup creates a .gitconfig fragment that points to the given ca.crt

type GitConfig added in v1.0.6

type GitConfig struct{}

GitConfig implements SCMAuth interface for using a custom .gitconfig file

func (GitConfig) Handles added in v1.0.6

func (_ GitConfig) Handles(name string) bool

Handles returns true if the secret file is a gitconfig

func (GitConfig) Name added in v1.0.6

func (_ GitConfig) Name() string

Name returns the name of this auth method.

func (GitConfig) Setup added in v1.0.6

func (_ GitConfig) Setup(baseDir string) (*url.URL, error)

Setup adds the secret .gitconfig as an include to the .gitconfig file to be used in the build

type SCMAuth

type SCMAuth interface {
	// Name is the name of the authentication method for use in log and error messages
	Name() string

	// Handles returns true if this authentication method handles a file with the given name
	Handles(name string) bool

	// Setup lays down the required files for this authentication method to work.
	// Returns the the source URL stripped of credentials.
	Setup(baseDir string) (*url.URL, error)
}

SCMAuth is an interface implemented by different authentication providers which are responsible for setting up the credentials to be used when accessing private repository.

type SSHPrivateKey

type SSHPrivateKey struct{}

SSHPrivateKey implements SCMAuth interface for using SSH private keys.

func (SSHPrivateKey) Handles added in v1.0.6

func (_ SSHPrivateKey) Handles(name string) bool

Handles returns true if the file is an SSH private key

func (SSHPrivateKey) Name

func (_ SSHPrivateKey) Name() string

Name returns the name of this auth method.

func (SSHPrivateKey) Setup

func (_ SSHPrivateKey) Setup(baseDir string) (*url.URL, error)

Setup creates a wrapper script for SSH command to be able to use the provided SSH key while accessing private repository.

type UsernamePassword added in v1.0.6

type UsernamePassword struct {
	SourceURL url.URL
}

UsernamePassword implements SCMAuth interface for using Username and Password credentials

func (UsernamePassword) Handles added in v1.0.6

func (_ UsernamePassword) Handles(name string) bool

Handles returns true if a username, password or token secret is present

func (UsernamePassword) Name added in v1.0.6

func (_ UsernamePassword) Name() string

Name returns the name of this auth method.

func (UsernamePassword) Setup added in v1.0.6

func (u UsernamePassword) Setup(baseDir string) (*url.URL, error)

Setup creates a gitconfig fragment that includes a substitution URL with the username/password included in the URL. Returns source URL stripped of username/password credentials.

Jump to

Keyboard shortcuts

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