auth

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package auth manages the available authentication methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthMethodsByName

func GetAuthMethodsByName(method string) ([]ssh.AuthMethod, error)

GetAuthMethodsByName returns SSH auth methods based on the specified method. If method is "auto", returns all available methods sorted by priority. Otherwise, returns only the specified method.

func GetAuthMethodsWithIdentity

func GetAuthMethodsWithIdentity(method string, identityFiles []string) ([]ssh.AuthMethod, error)

GetAuthMethodsWithIdentity returns SSH auth methods, using the provided identity files from SSH config if available. Identity files take priority over default key locations. If identityFiles is empty, falls back to default behavior.

func GetAvailableAuthMethods

func GetAvailableAuthMethods() ([]ssh.AuthMethod, error)

Types

type AgentAuthenticator

type AgentAuthenticator struct{}

AgentAuthenticator provides SSH authentication via the SSH agent.

func (*AgentAuthenticator) GetAuthMethod

func (a *AgentAuthenticator) GetAuthMethod() (ssh.AuthMethod, error)

func (*AgentAuthenticator) IsAvailable

func (a *AgentAuthenticator) IsAvailable() bool

func (*AgentAuthenticator) Name

func (a *AgentAuthenticator) Name() string

func (*AgentAuthenticator) Priority

func (a *AgentAuthenticator) Priority() int

type Authenticator

type Authenticator interface {
	Name() string
	GetAuthMethod() (ssh.AuthMethod, error)
	IsAvailable() bool
	Priority() int // Lower = higher priority (tried first)
}

Authenticator defines the interface for SSH authentication methods.

func GetAllAuthenticators

func GetAllAuthenticators() []Authenticator

func GetAvailableAuthenticators

func GetAvailableAuthenticators() []Authenticator

type PasswordAuthenticator

type PasswordAuthenticator struct {
	Password string // Optional: pre-configured password. If empty, prompts user.
}

PasswordAuthenticator provides SSH authentication via password.

func (*PasswordAuthenticator) GetAuthMethod

func (p *PasswordAuthenticator) GetAuthMethod() (ssh.AuthMethod, error)

func (*PasswordAuthenticator) IsAvailable

func (p *PasswordAuthenticator) IsAvailable() bool

func (*PasswordAuthenticator) Name

func (p *PasswordAuthenticator) Name() string

func (*PasswordAuthenticator) Priority

func (p *PasswordAuthenticator) Priority() int

type PublicKeyAuthenticator

type PublicKeyAuthenticator struct {
	KeyPath string // Optional: specific key path. If empty, checks default locations.
}

PublicKeyAuthenticator provides SSH authentication via private key files.

func (*PublicKeyAuthenticator) GetAuthMethod

func (p *PublicKeyAuthenticator) GetAuthMethod() (ssh.AuthMethod, error)

func (*PublicKeyAuthenticator) IsAvailable

func (p *PublicKeyAuthenticator) IsAvailable() bool

func (*PublicKeyAuthenticator) Name

func (p *PublicKeyAuthenticator) Name() string

func (*PublicKeyAuthenticator) Priority

func (p *PublicKeyAuthenticator) Priority() int

Jump to

Keyboard shortcuts

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