Documentation ¶
Index ¶
- type AppIDAuthStrategy
- func (a *AppIDAuthStrategy) Do(req *http.Request) (*http.Response, error)
- func (a *AppIDAuthStrategy) GetHTTPClient() *http.Client
- func (a *AppIDAuthStrategy) GetToken(addr *url.URL) (string, error)
- func (a *AppIDAuthStrategy) Revokable() bool
- func (a *AppIDAuthStrategy) SetToken(req *http.Request)
- func (a *AppIDAuthStrategy) String() string
- type AuthResponse
- type AuthStrategy
- type Client
- type ReadResponse
- type TokenAuthStrategy
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) GetHTTPClient ¶
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) SetToken ¶
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 (*Client) GetHTTPClient ¶
GetHTTPClient returns a client configured w/X-Vault-Token header
func (*Client) RevokeToken ¶
func (c *Client) RevokeToken()
RevokeToken - revoke the current auth token - effectively logging out
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) String ¶
func (a *TokenAuthStrategy) String() string