vault

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppIDAuthStrategy

type AppIDAuthStrategy struct {
	AppID  string `json:"app_id"`
	UserID string `json:"user_id"`
	// contains filtered or unexported fields
}

AppIDAuthStrategy - an AuthStrategy that uses Vault's app-id authentication backend.

func NewAppIDAuthStrategy

func NewAppIDAuthStrategy() *AppIDAuthStrategy

NewAppIDAuthStrategy - create an AuthStrategy that uses Vault's app-id auth backend.

func (*AppIDAuthStrategy) Do added in v1.2.1

func (a *AppIDAuthStrategy) Do(req *http.Request) (*http.Response, error)

Do wraps http.Client.Do

func (*AppIDAuthStrategy) GetHTTPClient added in v1.2.1

func (a *AppIDAuthStrategy) GetHTTPClient() *http.Client

GetHTTPClient configures the HTTP client with a timeout

func (*AppIDAuthStrategy) GetToken

func (a *AppIDAuthStrategy) GetToken(addr *url.URL) (string, error)

GetToken - log in to the app-id auth backend and return the client token

func (*AppIDAuthStrategy) Revokable

func (a *AppIDAuthStrategy) Revokable() bool

Revokable -

func (*AppIDAuthStrategy) SetToken added in v1.2.1

func (a *AppIDAuthStrategy) SetToken(req *http.Request)

SetToken is a no-op for AppIDAuthStrategy as a token hasn't been acquired yet

func (*AppIDAuthStrategy) String

func (a *AppIDAuthStrategy) String() string

type AuthResponse

type AuthResponse struct {
	Auth struct {
		ClientToken   string `json:"client_token"`
		LeaseDuration int64  `json:"lease_duration"`
		Metadata      struct {
			AppID  string `json:"app-id"`
			UserID string `json:"user-id"`
		} `json:"metadata"`
		Policies  []string `json:"policies"`
		Renewable bool     `json:"renewable"`
	} `json:"auth"`
}

AuthResponse - the Auth response from /v1/auth/app-id/login

func (*AuthResponse) String

func (a *AuthResponse) String() string

type AuthStrategy

type AuthStrategy interface {
	fmt.Stringer
	GetToken(addr *url.URL) (string, error)
	Revokable() bool
}

AuthStrategy -

type Client

type Client struct {
	Addr *url.URL
	Auth AuthStrategy
	// contains filtered or unexported fields
}

Client -

func NewClient

func NewClient() *Client

NewClient - instantiate a new

func (*Client) Do added in v1.2.1

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do wraps http.Client.Do

func (*Client) GetHTTPClient added in v1.2.1

func (c *Client) GetHTTPClient() *http.Client

GetHTTPClient returns a client configured w/X-Vault-Token header

func (*Client) Login

func (c *Client) Login() error

Login - log in to Vault with the discovered auth backend and save the token

func (*Client) Read

func (c *Client) Read(path string) ([]byte, error)

func (*Client) RevokeToken

func (c *Client) RevokeToken()

RevokeToken - revoke the current auth token - effectively logging out

func (*Client) SetToken added in v1.2.1

func (c *Client) SetToken(req *http.Request)

SetToken adds an X-Vault-Token header to the request

type ReadResponse

type ReadResponse struct {
	Data struct {
		Value string `json:"value"`
	} `json:"data"`
}

ReadResponse -

type TokenAuthStrategy

type TokenAuthStrategy struct {
	Token string
}

TokenAuthStrategy - a pass-through strategy for situations where we already have a Vault token.

func NewTokenAuthStrategy

func NewTokenAuthStrategy(fsOverrides ...vfs.Filesystem) *TokenAuthStrategy

NewTokenAuthStrategy - Try to create a new TokenAuthStrategy. If we can't nil will be returned.

func (*TokenAuthStrategy) GetToken

func (a *TokenAuthStrategy) GetToken(addr *url.URL) (string, error)

GetToken - return the token

func (*TokenAuthStrategy) Revokable

func (a *TokenAuthStrategy) Revokable() bool

Revokable -

func (*TokenAuthStrategy) String

func (a *TokenAuthStrategy) String() string

Jump to

Keyboard shortcuts

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