credentials

package
v0.0.0-...-b95b076 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConfigDir

func CreateConfigDir() error

CreateConfigDir - creates configuration directory tree.

func GetCADir

func GetCADir() string

GetCADir - returns certificate CA directory.

func GetPrivateKeyFile

func GetPrivateKeyFile() string

GetPrivateKeyFile - returns absolute path of private.key file.

func GetPublicCertFile

func GetPublicCertFile() string

GetPublicCertFile - returns absolute path of public.crt file.

func UTCNow

func UTCNow() time.Time

UTCNow - returns current UTC time.

Types

type ConfigDir

type ConfigDir struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ConfigDir - configuration directory with locking.

func (*ConfigDir) Create

func (config *ConfigDir) Create() error

Create - creates configuration directory tree.

func (*ConfigDir) Get

func (config *ConfigDir) Get() string

Get - returns current configuration directory.

func (*ConfigDir) GetCADir

func (config *ConfigDir) GetCADir() string

GetCADir - returns certificate CA directory.

func (*ConfigDir) GetPrivateKeyFile

func (config *ConfigDir) GetPrivateKeyFile() string

GetPrivateKeyFile - returns absolute path of private.key file.

func (*ConfigDir) GetPublicCertFile

func (config *ConfigDir) GetPublicCertFile() string

GetPublicCertFile - returns absolute path of public.crt file.

func (*ConfigDir) Set

func (config *ConfigDir) Set(dir string)

Set - saves given directory as configuration directory.

type Credential

type Credential struct {
	AccessKey  string    `xml:"AccessKeyId,omitempty" json:"accessKey,omitempty"`
	SecretKey  string    `xml:"SecretAccessKey,omitempty" json:"secretKey,omitempty"`
	Expiration time.Time `xml:"Expiration,omitempty" json:"expiration,omitempty"`
}

Credential - container for access and secret key, also carries expiration which indicates when the associated acces/secret keys are going to be expired.

func NewCredential

func NewCredential() (Credential, error)

NewCredential is similar to NewCredentialWithExpiration but the keys do not expire.

func NewCredentialWithExpiration

func NewCredentialWithExpiration(expiration time.Time) (Credential, error)

NewCredentialWithExpiration returns new Credentials for the requested access key and secret key length. Returns an error if there was an error in generating credentials.Optionally expiration can be set to signify the validity of these generated credentials.

func (Credential) Equal

func (c Credential) Equal(cc Credential) bool

Equal - returns whether two Credentials are equal or not.

func (Credential) IsExpired

func (c Credential) IsExpired() bool

IsExpired - returns whether Credential is expired or not.

type Store

type Store interface {
	// Sets a new credential to storage, returns a previous entry for the same accessKey.
	Set(cred Credential) (prevCred Credential)

	// Get fetch a saved credential for requested accessKey.
	Get(accessKey string) (cred Credential)

	// Delete a saved credential for the accessKey, returns a deleted copy of the entry.
	Delete(accessKey string) (prevCred Credential)

	// Loads all credentials from storage.
	Load() error

	// Saves all credentials to storage.
	Save() error
}

Store represents credential storage interface of all the generated credentials.

func NewStore

func NewStore() Store

NewStore - Initialize a new credetnials store.

Jump to

Keyboard shortcuts

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