Documentation
¶
Index ¶
- func AuthenticateRequest(authnURL string, conjurVersion string, account string, username string) (*http.Request, error)
- func DataResponse(resp *http.Response) ([]byte, error)
- func EmptyResponse(resp *http.Response) error
- func LoginRequest(authnURL string, conjurVersion string, csrBytes []byte, usernamePrefix string) (*http.Request, error)
- func NewError(resp *http.Response) error
- type Authenticator
- func (auth *Authenticator) Authenticate() ([]byte, error)
- func (auth *Authenticator) GenerateCSR(commonName string) ([]byte, error)
- func (auth *Authenticator) IsCertExpired() bool
- func (auth *Authenticator) IsLoggedIn() bool
- func (auth *Authenticator) Login() error
- func (auth *Authenticator) ParseAuthenticationResponse(response []byte) error
- type Error
- type ErrorDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateRequest ¶
func AuthenticateRequest(authnURL string, conjurVersion string, account string, username string) (*http.Request, error)
AuthenticateRequest sends an authenticate request
func DataResponse ¶
DataResponse checks the HTTP status of the response. If it's less than 300, it returns the response body as a byte array. Otherwise it returns a NewError.
func EmptyResponse ¶
EmptyResponse checks the HTTP status of the response. If it's less than 300, it returns without an error. Otherwise it returns a NewError.
Types ¶
type Authenticator ¶
type Authenticator struct { AccessToken access_token.AccessToken Config authnConfig.Config PublicCert *x509.Certificate // contains filtered or unexported fields }
Authenticator contains the configuration and client for the authentication connection to Conjur
func New ¶
func New(config authnConfig.Config) (*Authenticator, error)
func NewWithAccessToken ¶
func NewWithAccessToken(config authnConfig.Config, accessToken access_token.AccessToken) (*Authenticator, error)
func (*Authenticator) Authenticate ¶
func (auth *Authenticator) Authenticate() ([]byte, error)
Authenticate sends Conjur an authenticate request and returns the response data. Also manages state of certificates.
func (*Authenticator) GenerateCSR ¶
func (auth *Authenticator) GenerateCSR(commonName string) ([]byte, error)
GenerateCSR prepares the CSR
func (*Authenticator) IsCertExpired ¶
func (auth *Authenticator) IsCertExpired() bool
Returns true if certificate is expired or close to expiring
func (*Authenticator) IsLoggedIn ¶
func (auth *Authenticator) IsLoggedIn() bool
Returns true if we are logged in (have a cert)
func (*Authenticator) Login ¶
func (auth *Authenticator) Login() error
Login sends Conjur a CSR and verifies that the client cert is successfully retrieved
func (*Authenticator) ParseAuthenticationResponse ¶
func (auth *Authenticator) ParseAuthenticationResponse(response []byte) error
ParseAuthenticationResponse takes the response from the Authenticate request, decrypts if needed, and writes to the token file
type Error ¶
type Error struct { Code int Message string Details *ErrorDetails `json:"error"` }
Error includes the error info for Authenticator-related errors
type ErrorDetails ¶
ErrorDetails includes JSON data on authenticator.Errors