Documentation
¶
Overview ¶
Package model holds the SSH credential entity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SSHCredential ¶
type SSHCredential struct {
ID string `gorm:"column:ssh_credential_id;primaryKey;type:varchar(36)" json:"sshCredentialId"`
SSHCredentialName string `gorm:"column:ssh_credential_name;type:varchar(255);not null" json:"sshCredentialName"`
PublicKey string `gorm:"column:public_key;type:text;not null" json:"publicKey"`
PrivateKey string `gorm:"column:private_key;type:text;not null" json:"-"`
Passphrase *string `gorm:"column:passphrase;type:varchar(255)" json:"-"`
Password *string `gorm:"column:password;type:varchar(255)" json:"-"`
// Certificate based authentication. This indicates whether the SSH credential uses a certificate for authentication.
IsCertificate bool `gorm:"column:is_certificate;not null" json:"isCertificate"`
// FullInteractive indicates whether the SSH requires full interactive authentication.
FullInteractive bool `gorm:"column:full_interactive;not null" json:"fullInteractive"`
// OwnerID is varchar(255) to match users.user_id: a CILogon subject is far longer
// than a UUID. RESTRICT, so a user who still owns keys cannot be deleted out from
// under them.
OwnerID string `gorm:"column:owner_id;type:varchar(255);not null;index" json:"ownerId"`
Owner *iam.User `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"-"`
}
SSHCredential is a registered SSH credential.
PrivateKey and Passphrase are secrets: they are stored here but deliberately have no field on the read-side response DTO, so they cannot leak through a GET. Update paths must treat a blank incoming value as "unchanged" rather than "erase" — see ptr.NonBlank.
It belongs to whoever registered it, and — unlike every other owned record here — there is no sharing model to reach it by. A credential is the secret material itself rather than something reached with it, so a cluster config or a data storage may only present a credential its own owner registered. Sharing the config is how someone else submits under it; the credential never leaves its owner.
func (*SSHCredential) BeforeCreate ¶
func (k *SSHCredential) BeforeCreate(*gorm.DB) error
BeforeCreate assigns a UUID when none was supplied, replacing Hibernate's @GeneratedValue(strategy = GenerationType.UUID).
func (*SSHCredential) OwnedBy ¶
func (k *SSHCredential) OwnedBy(userID string) bool
func (SSHCredential) TableName ¶
func (SSHCredential) TableName() string
TableName returns the table backing SSHCredential.