sessions

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package sessions provides session authentication to the SecretHub API for the HTTP client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session interface {
	NeedsRefresh() bool
	Authenticator() auth.Authenticator
}

Session provides a auth.Authenticator than can be temporarily used to temporarily authenticate to the SecretHub API.

type SessionCreator

type SessionCreator interface {
	Create(httpClient *http.Client) (Session, error)
}

SessionCreator can create a new SecretHub session with a http.Client.

func NewAWSSessionCreator

func NewAWSSessionCreator(awsCfg ...*aws.Config) SessionCreator

NewAWSSessionCreator returns a SessionCreator that uses AWS STS authentication to request sessions.

func NewGCPSessionCreator added in v0.29.0

func NewGCPSessionCreator(gcpOptions ...option.ClientOption) SessionCreator

NewAWSSessionCreator returns a SessionCreator that uses a GCP Service Account Identity Token to request sessions.

type SessionRefresher

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

SessionRefresher implements auth.Authenticator by using sessions for authentication that are automatically refreshed when they are about to expire.

func NewSessionRefresher

func NewSessionRefresher(httpClient *httpclient.Client, sessionCreator SessionCreator) *SessionRefresher

NewSessionRefresher creates a new SessionRefresher that uses the httpClient for requesting new sessions with the SessionCreator.

func (*SessionRefresher) Authenticate

func (r *SessionRefresher) Authenticate(req *http.Request) error

Authenticate the given request with a session that is automatically refreshed when in almost expires.

Jump to

Keyboard shortcuts

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