Documentation ¶
Overview ¶
Package storage provides a storage backend for the Sharkey server. It provides an API for recording issuance of certificates. By default it is backed by a SQL database, but you could swap this package out for another one if you prefer something else -- many key-value stores would probably work.
Index ¶
- type MysqlStorage
- func (my *MysqlStorage) Migrate(migrationsDir string) error
- func (my *MysqlStorage) QueryGitHubMapping(ssoIdentity string) (string, error)
- func (my *MysqlStorage) QueryHostkeys() (ResultIterator, error)
- func (my *MysqlStorage) RecordGitHubMapping(mapping map[string]string) error
- func (my *MysqlStorage) RecordIssuance(certType uint32, principal string, pubkey ssh.PublicKey) (uint64, error)
- type ResultIterator
- type SqlResultIterator
- type SqliteStorage
- func (s *SqliteStorage) Migrate(migrationsDir string) error
- func (s *SqliteStorage) QueryGitHubMapping(ssoIdentity string) (string, error)
- func (s *SqliteStorage) QueryHostkeys() (ResultIterator, error)
- func (s *SqliteStorage) RecordGitHubMapping(mapping map[string]string) error
- func (s *SqliteStorage) RecordIssuance(certType uint32, principal string, pubkey ssh.PublicKey) (uint64, error)
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MysqlStorage ¶
MysqlStorage implements the storage interface, using Mysql for storage.
func (*MysqlStorage) Migrate ¶
func (my *MysqlStorage) Migrate(migrationsDir string) error
Migrate runs any pending migrations
func (*MysqlStorage) QueryGitHubMapping ¶
func (my *MysqlStorage) QueryGitHubMapping(ssoIdentity string) (string, error)
func (*MysqlStorage) QueryHostkeys ¶
func (my *MysqlStorage) QueryHostkeys() (ResultIterator, error)
func (*MysqlStorage) RecordGitHubMapping ¶
func (my *MysqlStorage) RecordGitHubMapping(mapping map[string]string) error
func (*MysqlStorage) RecordIssuance ¶
type ResultIterator ¶
type ResultIterator interface { Next() bool Get() (principal string, key ssh.PublicKey, err error) }
ResultIterator works like a typed sql.Rows: Call Next() and then Get() until Next() returns false
type SqlResultIterator ¶
This is shared between sqlite & mysql
func (*SqlResultIterator) Next ¶
func (r *SqlResultIterator) Next() bool
type SqliteStorage ¶
SqliteStorage implements the storage interface, using Sqlite for storage.
func (*SqliteStorage) Migrate ¶
func (s *SqliteStorage) Migrate(migrationsDir string) error
func (*SqliteStorage) QueryGitHubMapping ¶
func (s *SqliteStorage) QueryGitHubMapping(ssoIdentity string) (string, error)
func (*SqliteStorage) QueryHostkeys ¶
func (s *SqliteStorage) QueryHostkeys() (ResultIterator, error)
func (*SqliteStorage) RecordGitHubMapping ¶
func (s *SqliteStorage) RecordGitHubMapping(mapping map[string]string) error
func (*SqliteStorage) RecordIssuance ¶
type Storage ¶
type Storage interface { // Record an issuance of type (host or client) to principal with pubkey string // Returns an integer ID for the record (ie, database row primary key) RecordIssuance(certType uint32, principal string, pubkey ssh.PublicKey) (uint64, error) // Query all hostkeys QueryHostkeys() (ResultIterator, error) // Takes a path to DB migration locations Migrate(string) error // Record mapping of user identities to github username RecordGitHubMapping(mapping map[string]string) error // Retrieve github username given sso identity QueryGitHubMapping(ssoIdentity string) (string, error) Ping() error Close() error }
Click to show internal directories.
Click to hide internal directories.