securestorage

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCouldNotOpenKeyring error = errors.New("keyring not opened successfully")

Functions

This section is empty.

Types

type CFTokenStorage added in v0.8.0

type CFTokenStorage struct {
	Storage *SecureStorage
}

func NewCF added in v0.8.0

func NewCF() CFTokenStorage

type IAMCredentialsSecureStorage

type IAMCredentialsSecureStorage struct {
	SecureStorage SecureStorage
}

func NewSecureIAMCredentialStorage

func NewSecureIAMCredentialStorage() IAMCredentialsSecureStorage

func (*IAMCredentialsSecureStorage) GetCredentials

func (i *IAMCredentialsSecureStorage) GetCredentials(profile string) (credentials aws.Credentials, err error)

func (*IAMCredentialsSecureStorage) StoreCredentials

func (i *IAMCredentialsSecureStorage) StoreCredentials(profile string, credentials aws.Credentials) (err error)

type SSOToken

type SSOToken struct {
	// AccessToken is serialized as "AccessToken" to preserve backwards compatibility
	// with earlier versions of Granted. The native AWS CLI serializes this field in camelCase
	// as 'accessToken'. This field key may be changed in future to 'accessToken'.
	AccessToken string `json:"AccessToken"`
	// Expiry is serialized as "Expiry" to preserve backwards compatibility
	// with earlier versions of Granted. The native AWS CLI serializes this field in camelCase
	// as 'expiry'. This field key may be changed in future to 'expiry'.
	Expiry                time.Time `json:"Expiry"`
	ClientID              string    `json:"clientId,omitempty"`
	ClientSecret          string    `json:"clientSecret,omitempty"`
	RegistrationExpiresAt time.Time `json:"registrationExpiresAt,omitempty"`
	Region                string    `json:"region,omitempty"`
	RefreshToken          *string   `json:"refreshToken,omitempty"`
}

type SSOTokensSecureStorage

type SSOTokensSecureStorage struct {
	SecureStorage SecureStorage
}

func NewSecureSSOTokenStorage

func NewSecureSSOTokenStorage() SSOTokensSecureStorage

func (*SSOTokensSecureStorage) ClearSSOToken

func (s *SSOTokensSecureStorage) ClearSSOToken(profileKey string)

Attempts to clear the token, any errors will be logged to debug logging

func (*SSOTokensSecureStorage) GetValidSSOToken

func (s *SSOTokensSecureStorage) GetValidSSOToken(ctx context.Context, profileKey string) *SSOToken

GetValidSSOToken loads and potentially refreshes an AWS SSO access token from secure storage. It returns nil if no token was found, or if it is expired

func (*SSOTokensSecureStorage) StoreSSOToken

func (s *SSOTokensSecureStorage) StoreSSOToken(profileKey string, ssoTokenValue SSOToken)

Attempts to store the token, any errors will be logged to debug logging

type SecureStorage

type SecureStorage struct {
	StorageSuffix string
}

func (*SecureStorage) Clear

func (s *SecureStorage) Clear(key string) error

func (*SecureStorage) HasKey

func (s *SecureStorage) HasKey(key string) (bool, error)

returns false if the key is not found, true if it is found, or false and an error if there was a keyring related error

func (*SecureStorage) Keyring added in v0.8.0

func (s *SecureStorage) Keyring() (keyring.Keyring, error)

Keyring returns the underlying keyring associated with the storage.

func (*SecureStorage) List

func (s *SecureStorage) List() ([]keyring.Item, error)

func (*SecureStorage) ListKeys

func (s *SecureStorage) ListKeys() ([]string, error)

func (*SecureStorage) Retrieve

func (s *SecureStorage) Retrieve(key string, target interface{}) error

returns keyring.ErrKeyNotFound if not found

func (*SecureStorage) Store

func (s *SecureStorage) Store(key string, payload interface{}) error

type SessionCredentialSecureStorage added in v0.10.0

type SessionCredentialSecureStorage struct {
	SecureStorage SecureStorage
}

func NewSecureSessionCredentialStorage added in v0.10.0

func NewSecureSessionCredentialStorage() SessionCredentialSecureStorage

func (*SessionCredentialSecureStorage) GetCredentials added in v0.10.0

func (i *SessionCredentialSecureStorage) GetCredentials(profile string) (*aws.Credentials, error)

func (*SessionCredentialSecureStorage) StoreCredentials added in v0.10.0

func (i *SessionCredentialSecureStorage) StoreCredentials(profile string, credentials aws.Credentials) (err error)

Jump to

Keyboard shortcuts

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