session

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

sessioncache caches sessions (sts.Credentials)

sessioncache splits Stores (the way cache items are stored) from Keys (the way cache items are looked up/replaced)

Index

Constants

View Source
const KeyringItemKey = "session-cache"

TODO: make this configurable

View Source
const KeyringItemLabel = "aws-okta session cache"

Variables

View Source
var ErrSessionExpired = errors.New("session expired")

Functions

This section is empty.

Types

type Key

type Key interface {
	Key() string
}

Key is used to compute the cache key for a session

type KeyWithProfileARN

type KeyWithProfileARN struct {
	ProfileName string
	ProfileConf map[string]string
	Duration    time.Duration
	ProfileARN  string
}

func (KeyWithProfileARN) Key

func (k KeyWithProfileARN) Key() string

Key returns a key for the keyring item. For all purposes it behaves the same way as OrigKey but also takes the ProfileARN into account when generating the key value.

type KeyringSessionCache

type KeyringSessionCache struct {
	// contains filtered or unexported fields
}

func (*KeyringSessionCache) Get

func (s *KeyringSessionCache) Get(key string) ([]byte, error)

func (*KeyringSessionCache) Put

func (s *KeyringSessionCache) Put(key string, data []byte, label string) error

type Session

type Session struct {
	Name string
	sts.Credentials
}

Session adds a session name to sts.Credentials

func (*Session) Bytes

func (s *Session) Bytes() ([]byte, error)

type SingleKrItemStore

type SingleKrItemStore struct {
	Keyring keyring.Keyring
}

SingleKrItemStore stores all sessions in a single keyring item

This is mostly for MacOS keychain, where because we don't sign aws-okta properly, the user needs to reauth the aws-okta binary for every item on every upgrade. By collapsing all sessions into a single item, we only need to reauth once per upgrade/build

func (*SingleKrItemStore) Get

func (s *SingleKrItemStore) Get(k Key) (*Session, error)

Get loads the db from the keyring, and returns the session at k.Key()

If the keyring item is not found (the db hasn't been written) or the key is not found, returns wrapped keyring.ErrKeyNotFound

If the session is found, but is expired, returns wrapped ErrSessionExpired

func (*SingleKrItemStore) Put

func (s *SingleKrItemStore) Put(k Key, session *Session) error

Jump to

Keyboard shortcuts

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