Documentation
¶
Index ¶
- Constants
- func BasicAuthTransport(username, password string) *http.Client
- func DecodePEMBytes(buf []byte) ([]*pem.Block, []byte, error)
- func FindCACertificate(caCertificatePath string) ([]*x509.Certificate, error)
- type Authenticator
- type BasicAuthAuthenticator
- type CommandAuthConfig
- func (c *CommandAuthConfig) Authenticate() error
- func (c *CommandAuthConfig) SetClient(client *http.Client) *http.Client
- func (c *CommandAuthConfig) ValidateAuthConfig() error
- func (c *CommandAuthConfig) WithCommandAPIPath(apiPath string) *CommandAuthConfig
- func (c *CommandAuthConfig) WithCommandCACert(caCert string) *CommandAuthConfig
- func (c *CommandAuthConfig) WithCommandHostName(hostName string) *CommandAuthConfig
- func (c *CommandAuthConfig) WithCommandPort(port string) *CommandAuthConfig
- func (c *CommandAuthConfig) WithHttpClient(client *http.Client) *CommandAuthConfig
- func (c *CommandAuthConfig) WithSkipVerify(skipVerify bool) *CommandAuthConfig
- type CommandAuthConfigBasic
- func (a *CommandAuthConfigBasic) Authenticate() error
- func (a *CommandAuthConfigBasic) Build() (Authenticator, error)
- func (a *CommandAuthConfigBasic) ValidateAuthConfig() error
- func (a *CommandAuthConfigBasic) WithPassword(password string) *CommandAuthConfigBasic
- func (a *CommandAuthConfigBasic) WithUsername(username string) *CommandAuthConfigBasic
- type CommandConfigOauth
- func (b *CommandConfigOauth) Authenticate() error
- func (b *CommandConfigOauth) Build() (Authenticator, error)
- func (b *CommandConfigOauth) ValidateAuthConfig() error
- func (b *CommandConfigOauth) WithAudience(audience string) *CommandConfigOauth
- func (b *CommandConfigOauth) WithCaCertificatePath(caCertificatePath string) *CommandConfigOauth
- func (b *CommandConfigOauth) WithCaCertificates(caCertificates []*x509.Certificate) *CommandConfigOauth
- func (b *CommandConfigOauth) WithClientId(clientId string) *CommandConfigOauth
- func (b *CommandConfigOauth) WithClientSecret(clientSecret string) *CommandConfigOauth
- func (b *CommandConfigOauth) WithScopes(scopes []string) *CommandConfigOauth
- func (b *CommandConfigOauth) WithTokenUrl(tokenUrl string) *CommandConfigOauth
- type OAuthAuthenticator
Constants ¶
View Source
const ( DefaultCommandPort = "443" DefaultCommandAPIPath = "KeyfactorAPI" DefaultAPIVersion = "1" DefaultAPIClientName = "APIClient" DefaultProductVersion = "10.5.0.0" EnvKeyfactorHostName = "KEYFACTOR_HOSTNAME" EnvKeyfactorPort = "KEYFACTOR_PORT" EnvKeyfactorAPIPath = "KEYFACTOR_API_PATH" EnvKeyfactorSkipVerify = "KEYFACTOR_SKIP_VERIFY" EnvKeyfactorCACert = "KEYFACTOR_CA_CERT" EnvKeyfactorAuthProvider = "KEYFACTOR_AUTH_PROVIDER" )
View Source
const ( // DefaultKeyfactorAuthPort is the default port for Keyfactor authentication DefaultKeyfactorAuthPort = "8444" // DefaultTokenPrefix is the default token prefix for Keyfactor authentication headers DefaultTokenPrefix = "Bearer" // EnvKeyfactorClientID is the environment variable used to set the client ID for oauth client credentials authentication EnvKeyfactorClientID = "KEYFACTOR_AUTH_CLIENT_ID" // EnvKeyfactorClientSecret is the environment variable used to set the client secret for oauth client credentials authentication EnvKeyfactorClientSecret = "KEYFACTOR_AUTH_CLIENT_SECRET" // EnvKeyfactorAuthTokenURL EnvCommandTokenURL is the environment variable used to set the token URL for oauth client credentials authentication EnvKeyfactorAuthTokenURL = "KEYFACTOR_AUTH_TOKEN_URL" // EnvKeyfactorAccessToken is the environment variable used to set the access token for oauth client credentials authentication EnvKeyfactorAccessToken = "KEYFACTOR_ACCESS_TOKEN" // EnvKeyfactorAuthAudience is the environment variable used to set the audience for oauth client credentials //authentication EnvKeyfactorAuthAudience = "KEYFACTOR_AUTH_AUDIENCE" // EnvKeyfactorAuthScopes is the environment variable used to set the scopes for oauth client credentials authentication EnvKeyfactorAuthScopes = "KEYFACTOR_AUTH_SCOPES" // EnvKeyfactorAuthHostname is the environment variable used to set the hostname for oauth client credentials authentication EnvKeyfactorAuthHostname = "KEYFACTOR_AUTH_HOSTNAME" // EnvKeyfactorAuthPort is the environment variable used to set the port for oauth client credentials authentication EnvKeyfactorAuthPort = "KEYFACTOR_AUTH_PORT" // EnvAuthCACert is a path to a CA certificate for the OAuth client credentials authentication EnvAuthCACert = "KEYFACTOR_AUTH_CA_CERT" )
Variables ¶
This section is empty.
Functions ¶
func BasicAuthTransport ¶
func FindCACertificate ¶
func FindCACertificate(caCertificatePath string) ([]*x509.Certificate, error)
Types ¶
type Authenticator ¶
Authenticator is an interface for authentication to Keyfactor Command API.
type BasicAuthAuthenticator ¶
type BasicAuthAuthenticator struct {
// contains filtered or unexported fields
}
func (*BasicAuthAuthenticator) GetHttpClient ¶
func (b *BasicAuthAuthenticator) GetHttpClient() (*http.Client, error)
type CommandAuthConfig ¶
type CommandAuthConfig struct {
// ConfigType is the type of configuration
ConfigType string `json:"config_type"`
// AuthHeader is the header to be used for authentication to Keyfactor Command API
AuthHeader string `json:"auth_header"`
// CommandHostName is the hostname of the Keyfactor Command API
CommandHostName string `json:"command_host_name"`
// CommandPort is the port of the Keyfactor Command API
CommandPort string `json:"command_port"`
// CommandAPIPath is the path of the Keyfactor Command API, default is "KeyfactorAPI"
CommandAPIPath string `json:"command_api_path"`
// CommandAPIVersion is the version of the Keyfactor Command API, default is "1"
CommandVersion string `json:"command_version"`
// CommandCACert is the CA certificate to be used for authentication to Keyfactor Command API for use with not widely trusted certificates. This can be a filepath or a string of the certificate in PEM format.
CommandCACert string `json:"command_ca_cert"`
// SkipVerify is a flag to skip verification of the server's certificate chain and host name. Default is false.
SkipVerify bool `json:"skip_verify"`
// HttpClient is the http client to be used for authentication to Keyfactor Command API
HttpClient *http.Client
}
CommandAuthConfig represents the base configuration needed for authentication to Keyfactor Command API.
func (*CommandAuthConfig) Authenticate ¶
func (c *CommandAuthConfig) Authenticate() error
Authenticate performs the authentication test to Keyfactor Command API and sets Command product version.
func (*CommandAuthConfig) SetClient ¶
func (c *CommandAuthConfig) SetClient(client *http.Client) *http.Client
SetClient sets the http client for authentication to Keyfactor Command API.
func (*CommandAuthConfig) ValidateAuthConfig ¶
func (c *CommandAuthConfig) ValidateAuthConfig() error
ValidateAuthConfig validates the authentication configuration for Keyfactor Command API.
func (*CommandAuthConfig) WithCommandAPIPath ¶
func (c *CommandAuthConfig) WithCommandAPIPath(apiPath string) *CommandAuthConfig
func (*CommandAuthConfig) WithCommandCACert ¶
func (c *CommandAuthConfig) WithCommandCACert(caCert string) *CommandAuthConfig
func (*CommandAuthConfig) WithCommandHostName ¶
func (c *CommandAuthConfig) WithCommandHostName(hostName string) *CommandAuthConfig
func (*CommandAuthConfig) WithCommandPort ¶
func (c *CommandAuthConfig) WithCommandPort(port string) *CommandAuthConfig
func (*CommandAuthConfig) WithHttpClient ¶
func (c *CommandAuthConfig) WithHttpClient(client *http.Client) *CommandAuthConfig
func (*CommandAuthConfig) WithSkipVerify ¶
func (c *CommandAuthConfig) WithSkipVerify(skipVerify bool) *CommandAuthConfig
type CommandAuthConfigBasic ¶
type CommandAuthConfigBasic struct {
// CommandAuthConfig is a reference to the base configuration needed for authentication to Keyfactor Command API
CommandAuthConfig
// Username is the username to be used for authentication to Keyfactor Command API
Username string `json:"username"`
// Password is the password to be used for authentication to Keyfactor Command API
Password string `json:"password"`
}
CommandAuthConfigBasic represents the base configuration needed for authentication to Keyfactor Command API.
func NewBasicAuthAuthenticatorBuilder ¶
func NewBasicAuthAuthenticatorBuilder() *CommandAuthConfigBasic
func (*CommandAuthConfigBasic) Authenticate ¶
func (a *CommandAuthConfigBasic) Authenticate() error
func (*CommandAuthConfigBasic) Build ¶
func (a *CommandAuthConfigBasic) Build() (Authenticator, error)
func (*CommandAuthConfigBasic) ValidateAuthConfig ¶
func (a *CommandAuthConfigBasic) ValidateAuthConfig() error
func (*CommandAuthConfigBasic) WithPassword ¶
func (a *CommandAuthConfigBasic) WithPassword(password string) *CommandAuthConfigBasic
func (*CommandAuthConfigBasic) WithUsername ¶
func (a *CommandAuthConfigBasic) WithUsername(username string) *CommandAuthConfigBasic
type CommandConfigOauth ¶
type CommandConfigOauth struct {
CommandAuthConfig
ClientID string `json:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty"`
TokenURL string `json:"token_url,omitempty"`
Audience string `json:"audience,omitempty"`
Scopes []string `json:"scopes,omitempty"`
CACertificatePath string `json:"idp_ca_cert_path,omitempty"`
CACertificates []*x509.Certificate `json:"-"`
}
func NewOAuthAuthenticatorBuilder ¶
func NewOAuthAuthenticatorBuilder() *CommandConfigOauth
func (*CommandConfigOauth) Authenticate ¶
func (b *CommandConfigOauth) Authenticate() error
func (*CommandConfigOauth) Build ¶
func (b *CommandConfigOauth) Build() (Authenticator, error)
func (*CommandConfigOauth) ValidateAuthConfig ¶
func (b *CommandConfigOauth) ValidateAuthConfig() error
func (*CommandConfigOauth) WithAudience ¶
func (b *CommandConfigOauth) WithAudience(audience string) *CommandConfigOauth
func (*CommandConfigOauth) WithCaCertificatePath ¶
func (b *CommandConfigOauth) WithCaCertificatePath(caCertificatePath string) *CommandConfigOauth
func (*CommandConfigOauth) WithCaCertificates ¶
func (b *CommandConfigOauth) WithCaCertificates(caCertificates []*x509.Certificate) *CommandConfigOauth
func (*CommandConfigOauth) WithClientId ¶
func (b *CommandConfigOauth) WithClientId(clientId string) *CommandConfigOauth
func (*CommandConfigOauth) WithClientSecret ¶
func (b *CommandConfigOauth) WithClientSecret(clientSecret string) *CommandConfigOauth
func (*CommandConfigOauth) WithScopes ¶
func (b *CommandConfigOauth) WithScopes(scopes []string) *CommandConfigOauth
func (*CommandConfigOauth) WithTokenUrl ¶
func (b *CommandConfigOauth) WithTokenUrl(tokenUrl string) *CommandConfigOauth
type OAuthAuthenticator ¶
type OAuthAuthenticator struct {
// contains filtered or unexported fields
}
OAuthAuthenticator is an Authenticator that uses OAuth2 for authentication.
func (*OAuthAuthenticator) GetHttpClient ¶
func (a *OAuthAuthenticator) GetHttpClient() (*http.Client, error)
Click to show internal directories.
Click to hide internal directories.