auth

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServicePAT     = "azure-devops-cli-pat"
	ServiceAAD     = "azure-devops-cli-aad"
	ServiceRefresh = "azure-devops-cli-refresh"
)

Variables

View Source
var (
	ErrPATRequired               = &AuthError{message: "PAT is required for PAT authentication"}
	ErrClientIDRequired          = &AuthError{message: "Client ID is required for OAuth authentication"}
	ErrClientIDAndTenantRequired = &AuthError{message: "Client ID and Tenant ID are required for service principal authentication"}
	ErrInvalidAuthType           = &AuthError{message: "Invalid authentication type"}
)

Functions

func CredentialAccount added in v0.1.3

func CredentialAccount(account string) string

Types

type AuthConfig

type AuthConfig struct {
	Type         AuthType `json:"type" yaml:"type"`
	PAT          string   `json:"pat,omitempty" yaml:"pat,omitempty"`
	ClientID     string   `json:"clientId,omitempty" yaml:"clientId,omitempty"`
	ClientSecret string   `json:"clientSecret,omitempty" yaml:"clientSecret,omitempty"`
	TenantID     string   `json:"tenantId,omitempty" yaml:"tenantId,omitempty"`
	ManagedID    string   `json:"managedId,omitempty" yaml:"managedId,omitempty"`
	Scopes       []string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
}

func NewAuthConfig

func NewAuthConfig(authType AuthType) *AuthConfig

func (*AuthConfig) GetScopes

func (a *AuthConfig) GetScopes() []string

func (*AuthConfig) Validate

func (a *AuthConfig) Validate() error

type AuthError

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

func (*AuthError) Error

func (e *AuthError) Error() string

type AuthHeaders

type AuthHeaders map[string]string

type AuthType

type AuthType string
const (
	AuthTypePAT             AuthType = "pat"
	AuthTypeOAuth           AuthType = "oauth"
	AuthTypeManagedIdentity AuthType = "managed-identity"
	AuthTypeSPN             AuthType = "spn"
)

type Authenticator

type Authenticator interface {
	Validate() bool
	Authenticate() (AuthHeaders, error)
	GetHeaders() AuthHeaders
	GetScopes() []string
	GetExpiration() *int64
}

type CredentialEntry

type CredentialEntry struct {
	Service    string `json:"service"`
	Account    string `json:"account"`
	Credential string `json:"credential"`
	CreatedAt  int64  `json:"createdAt"`
}

type CredentialManager

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

func NewCredentialManager

func NewCredentialManager(storageDir string) (*CredentialManager, error)

func (*CredentialManager) DeletePAT

func (c *CredentialManager) DeletePAT(service, account string) error

func (*CredentialManager) GetBackend

func (c *CredentialManager) GetBackend() string

func (*CredentialManager) GetPAT

func (c *CredentialManager) GetPAT(service, account string) (string, error)

func (*CredentialManager) GetStoragePath

func (c *CredentialManager) GetStoragePath() string

func (*CredentialManager) IsPlatformManagerAvailable

func (c *CredentialManager) IsPlatformManagerAvailable() bool

func (*CredentialManager) SavePAT

func (c *CredentialManager) SavePAT(service, account, pat string) error

Jump to

Keyboard shortcuts

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