Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCredentials is the error returned by NewRoundTripper if user used empty string for a credentials. ErrInvalidCredentials = errors.New("uid, secret and loginEndpoit cannot be empty") // ErrInvalidUserAgent is the error returned by NewRoundTripper if user used empty string for a user agent. ErrInvalidUserAgent = errors.New("userAgent cannot be empty") // ErrInvalidExpireDuration is the error returned by NewRoundTripper if the token expire duration is negative or // zero value. ErrInvalidExpireDuration = errors.New("token expire duration must be positive non zero value") )
var ( // ErrEmptyToken returned by `GenerateToken` if signed string returned empty string. ErrEmptyToken = errors.New("Empty token") // ErrWrongRoundTripperImpl returned by `CurrentToken` if http.RoundTripper does not implement implWithJWT. ErrWrongRoundTripperImpl = errors.New("RoundTripper does not implement OptionRoundtripperFunc") )
Functions ¶
func NewRoundTripper ¶
func NewRoundTripper(rt http.RoundTripper, opts ...OptionRoundtripperFunc) (http.RoundTripper, error)
NewRoundTripper returns RoundTripper implementation with JWT handling.
func NewTransport ¶
func NewTransport(clientOptionFuncs ...OptionTransportFunc) (http.RoundTripper, error)
NewTransport returns a DC/OS transport implementation by leveraging a roundtripper for IAM configuration if passed with a pre-configured TLS configuration.
Types ¶
type Debug ¶
Debug is an interface which defines methods to generate a token and get the latest generated token.
func DebugTransport ¶
func DebugTransport(rt http.RoundTripper) (Debug, error)
DebugTransport is a function user can use to get a token from decorated http.RoundTripper if it implements implWithJWT.
type ErrTokenRefresh ¶
type ErrTokenRefresh struct {
// contains filtered or unexported fields
}
ErrTokenRefresh is an error type returned by `RoundTrip` if the bouncer response was not 200.
func (ErrTokenRefresh) Error ¶
func (e ErrTokenRefresh) Error() string
type OptionRoundtripperFunc ¶
type OptionRoundtripperFunc func(*dcosRoundtripper) error
OptionRoundtripperFunc type sets options configurations for the DC/OS HTTP roundtripper
func OptionCredentials ¶
func OptionCredentials(uid, secret, loginEndpoint string) OptionRoundtripperFunc
OptionCredentials is an option to set uid, secret and loginEndpoint.
func OptionReadIAMConfig ¶
func OptionReadIAMConfig(path string) OptionRoundtripperFunc
OptionReadIAMConfig is an option to read the IAMConfig from file system and populate uid, secret and loginEndpoint.
func OptionTokenExpire ¶
func OptionTokenExpire(t time.Duration) OptionRoundtripperFunc
OptionTokenExpire is an option to set JWT expiration date. If not set 24h is ussed by default.
func OptionUserAgent ¶
func OptionUserAgent(userAgent string) OptionRoundtripperFunc
OptionUserAgent is an option to set userAgent
type OptionTransportFunc ¶
type OptionTransportFunc func(*dcosTransport) error
OptionTransportFunc type sets optional configurations for the DC/OS HTTP transport
func OptionCaCertificatePath ¶
func OptionCaCertificatePath(caCertificatePath string) OptionTransportFunc
OptionCaCertificatePath sets the CA certificate path option.
func OptionIAMConfigPath ¶
func OptionIAMConfigPath(iamConfigPath string) OptionTransportFunc
OptionIAMConfigPath sets the IAM configuration path option.