credential

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package credential defines interfaces shared by other packages that manage credentials for Boundary sessions.

Index

Constants

View Source
const (
	UsernamePasswordSubtype = subtypes.Subtype("username_password")

	SshPrivateKeySubtype = subtypes.Subtype("ssh_private_key")

	JsonSubtype = subtypes.Subtype("json")
)
View Source
const Domain = "credential"

Domain defines the domain for the credential package.

Variables

ValidPurposes are the set of all credential Purposes.

Functions

func GetOpts added in v0.11.1

func GetOpts(opt ...Option) (*options, error)

GetOpts - iterate the inbound Options and return a struct

func NewJsonCredentialId added in v0.11.0

func NewJsonCredentialId(ctx context.Context) (string, error)

func NewSshPrivateKeyCredentialId added in v0.10.0

func NewSshPrivateKeyCredentialId(ctx context.Context) (string, error)

func NewUsernamePasswordCredentialId added in v0.10.0

func NewUsernamePasswordCredentialId(ctx context.Context) (string, error)

Types

type Credential

type Credential interface {
	boundary.Entity
	Secret() SecretData
}

Credential is an entity containing secret data.

type Dynamic

type Dynamic interface {
	Credential
	GetSessionId() string
	Library() Library
	Purpose() Purpose
}

Dynamic is a credential generated by a library for a specific session.

type Issuer

type Issuer interface {
	// Issue issues dynamic credentials for a session from the requested
	// libraries and for the requested purposes. The sessionId must be a
	// valid sessionId. The SourceId in each request must be the public id
	// of a library the Issuer can issue credentials from.
	//
	// If Issue encounters an error, it returns no credentials and revokes
	// any credentials issued before encountering the error.
	//
	// Supported Options: WithTemplateData
	Issue(ctx context.Context, sessionId string, requests []Request, opt ...Option) ([]Dynamic, error)
}

Issuer issues dynamic credentials.

type JsonObject added in v0.11.0

type JsonObject struct {
	structpb.Struct
}

JsonObject represents a JSON object that is serialized.

func (*JsonObject) GoString added in v0.11.0

func (s *JsonObject) GoString() string

GoString returns a string with the json secret redacted.

func (*JsonObject) MarshalJSON added in v0.11.0

func (s *JsonObject) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON-encoded byte slice with the json redacted.

func (*JsonObject) String added in v0.11.0

func (s *JsonObject) String() string

String returns a string with the json secret redacted.

type Library

type Library interface {
	boundary.Resource
	GetStoreId() string
	CredentialType() Type
}

A Library is a resource that provides credentials that are of the same type and access level from a single store.

type Option added in v0.11.1

type Option func(*options) error

Option - how Options are passed as arguments.

func WithTemplateData added in v0.11.1

func WithTemplateData(with template.Data) Option

WithTemplateData provides a way to pass in template information

type Password added in v0.6.1

type Password string

Password represents a secret password.

func (Password) GoString added in v0.6.1

func (s Password) GoString() string

GoString returns a string with the password redacted.

func (Password) MarshalJSON added in v0.6.1

func (s Password) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON-encoded string with the password redacted.

func (Password) String added in v0.6.1

func (s Password) String() string

String returns a string with the password redacted.

type PrivateKey added in v0.6.1

type PrivateKey []byte

PrivateKey represents a secret private key.

func (PrivateKey) GoString added in v0.6.1

func (s PrivateKey) GoString() string

GoString returns a string with the private key redacted.

func (PrivateKey) MarshalJSON added in v0.6.1

func (s PrivateKey) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON-encoded byte slice with the private key redacted.

func (PrivateKey) String added in v0.6.1

func (s PrivateKey) String() string

String returns a string with the private key redacted.

type Purpose

type Purpose string

Purpose is the purpose of the credential.

const (
	// BrokeredPurpose is a credential used for brokering specific
	// purposes. Brokered credentials are returned to the user.
	BrokeredPurpose Purpose = "brokered"

	// InjectedApplicationPurpose is a credential used by a boundary
	// worker to secure the connection between the worker and the endpoint.
	// Injected Application credentials are never returned to the user.
	InjectedApplicationPurpose Purpose = "injected_application"
)

Credential purpose values.

func (Purpose) String added in v0.7.0

func (p Purpose) String() string

type Request

type Request struct {
	SourceId string
	Purpose  Purpose
}

A Request represents a request for a credential from the SourceId for the given purpose. For dynamic credentials, the SourceId is the PublicId of a credential library.

type Revoker

type Revoker interface {
	// Revoke revokes the dynamic credentials issued for sessionid.
	Revoke(ctx context.Context, sessionId string) error
}

Revoker revokes dynamic credentials.

type SecretData

type SecretData any

SecretData represents secret data.

type SshCertificate added in v0.12.0

type SshCertificate interface {
	SshPrivateKey
	Certificate() []byte
}

SshCertificate is a credential containing a client certificate, username, and SSH private key.

type SshPrivateKey added in v0.10.0

type SshPrivateKey interface {
	Credential
	Username() string
	PrivateKey() PrivateKey
	PrivateKeyPassphrase() []byte
}

SshPrivateKey is a credential containing a username an SSH private key and an optional private key passphrase.

type Static added in v0.9.0

type Static interface {
	boundary.Resource
	GetStoreId() string
}

Static is a static credential that is stored directly in a credential store.

type Store

type Store interface {
	boundary.Resource
	GetProjectId() string
}

A Store is a resource that can store, retrieve, and potentially generate credentials of differing types and access levels. It belongs to a project and must support the principle of least privilege by providing mechanisms to limit the credentials it can access to the minimum necessary for the project it is in.

type Type added in v0.7.4

type Type string

Type is the type of credential provided by a library.

const (
	UnspecifiedType      Type = "unspecified"
	UsernamePasswordType Type = "username_password"
	SshPrivateKeyType    Type = "ssh_private_key"
	SshCertificateType   Type = "ssh_certificate"
	JsonType             Type = "json"
)

Credential type values.

type UsernamePassword added in v0.9.0

type UsernamePassword interface {
	Credential
	Username() string
	Password() Password
}

UsernamePassword is a credential containing a username and a password.

Directories

Path Synopsis
Package static implements a credential store for static credentials.
Package static implements a credential store for static credentials.
Package vault provides access to credentials retrieved from a Vault server.
Package vault provides access to credentials retrieved from a Vault server.
internal/sshprivatekey
Package sshprivatekey provides access to the username and ssh private key stored in a Vault secret.
Package sshprivatekey provides access to the username and ssh private key stored in a Vault secret.
internal/usernamepassword
Package usernamepassword provides access to the username and password stored in a Vault secret.
Package usernamepassword provides access to the username and password stored in a Vault secret.

Jump to

Keyboard shortcuts

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