credential

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package credential provides a pluggable abstraction for file-based credentials that kdn intercepts when declared as workspace mounts. A placeholder file is substituted so the real secret never lands inside the container; actual auth flows through the OneCLI proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential interface {
	// Name returns the unique identifier for this credential type (e.g. "gcloud", "kubeconfig").
	Name() string

	// ContainerFilePath returns the absolute path inside the container at which
	// the placeholder file must be mounted.
	ContainerFilePath() string

	// Detect scans workspace mounts and returns the resolved host-side path to
	// the real credential file and the mount entry to intercept.
	// Returns ("", nil) when this credential is not declared or not applicable.
	Detect(mounts []workspace.Mount, homeDir string) (hostFilePath string, intercepted *workspace.Mount)

	// FakeFile returns the bytes to write as the placeholder credential file
	// that will be mounted into the container instead of the real one.
	// hostFilePath is the path to the real credential on the host.
	FakeFile(hostFilePath string) ([]byte, error)

	// Configure performs any OneCLI setup needed when this credential is active
	// (e.g. calling ConnectApp or creating secrets with the real credential).
	// hostFilePath is the path to the real credential on the host.
	Configure(ctx context.Context, client onecli.Client, hostFilePath string) error

	// HostPatterns returns host globs to add to the allow list in deny-mode
	// networking when this credential is active. hostFilePath lets dynamic
	// implementations extract the server URL from the real credential file.
	HostPatterns(hostFilePath string) []string
}

Credential describes how a particular file-based credential is intercepted when declared as a workspace mount.

type Registry

type Registry interface {
	// Register adds a credential implementation to the registry.
	// Returns an error if a credential with the same name is already registered.
	Register(c Credential) error

	// List returns all registered credentials.
	List() []Credential
}

Registry manages Credential implementations.

func NewRegistry

func NewRegistry() Registry

NewRegistry creates a new credential registry.

Directories

Path Synopsis
Package gcloud implements the credential.Credential interface for Google Cloud Application Default Credentials (ADC).
Package gcloud implements the credential.Credential interface for Google Cloud Application Default Credentials (ADC).
Package kubeconfig implements the credential.Credential interface for Kubernetes token-based authentication.
Package kubeconfig implements the credential.Credential interface for Kubernetes token-based authentication.

Jump to

Keyboard shortcuts

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