Documentation
¶
Index ¶
Constants ¶
View Source
const UserIDWildcard = "{user_id}"
Variables ¶
View Source
var ( ErrInvalidConfig = errors.New("invalid client config") ErrUnknownProviderType = errors.New("unknown provider type") )
View Source
var ErrFailedRequest = errors.New("request failed")
Functions ¶
func NewShieldClient ¶
func NewShieldClient(config *ShieldClientConfig) (*shieldClient, error)
Types ¶
type HTTPAuthConfig ¶
type HTTPAuthConfig struct {
Type string `mapstructure:"type" json:"type" yaml:"type" validate:"required,oneof=basic api_key bearer google_idtoken"`
// basic auth
Username string `mapstructure:"username,omitempty" json:"username,omitempty" yaml:"username,omitempty" validate:"required_if=Type basic"`
Password string `mapstructure:"password,omitempty" json:"password,omitempty" yaml:"password,omitempty" validate:"required_if=Type basic"`
// api key
In string `` /* 132-byte string literal not displayed */
Key string `mapstructure:"key,omitempty" json:"key,omitempty" yaml:"key,omitempty" validate:"required_if=Type api_key"`
Value string `mapstructure:"value,omitempty" json:"value,omitempty" yaml:"value,omitempty" validate:"required_if=Type api_key"`
// bearer
Token string `mapstructure:"token,omitempty" json:"token,omitempty" yaml:"token,omitempty" validate:"required_if=Type bearer"`
// google_idtoken
Audience string `` /* 128-byte string literal not displayed */
// TODO: allow base64 encoded credentials
CredentialsJSON string `` /* 152-byte string literal not displayed */
}
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient wraps the http client for external approver resolver service
func NewHTTPClient ¶
func NewHTTPClient(config *HTTPClientConfig) (*HTTPClient, error)
NewHTTPClient returns *iam.Client
func (*HTTPClient) GetUser ¶
func (c *HTTPClient) GetUser(userID string) (interface{}, error)
GetUser fetches user details to external
type HTTPClientConfig ¶
type HTTPClientConfig struct {
URL string `mapstructure:"url" json:"url" yaml:"url" validate:"required,url"`
Headers map[string]string `mapstructure:"headers,omitempty" json:"headers,omitempty" yaml:"headers,omitempty"`
Auth *HTTPAuthConfig `mapstructure:"auth,omitempty" json:"auth,omitempty" yaml:"auth,omitempty" validate:"omitempty,dive"`
HTTPClient *http.Client `mapstructure:"-" json:"-" yaml:"-"`
// contains filtered or unexported fields
}
HTTPClientConfig is the configuration required by iam.Client
func (*HTTPClientConfig) Decrypt ¶
func (c *HTTPClientConfig) Decrypt() error
func (*HTTPClientConfig) Encrypt ¶
func (c *HTTPClientConfig) Encrypt() error
func (*HTTPClientConfig) Validate ¶
func (c *HTTPClientConfig) Validate() error
type ShieldClientConfig ¶
type ShieldClientConfig struct {
Host string `mapstructure:"host" json:"host" yaml:"host" validate:"required,url"`
// contains filtered or unexported fields
}
func (*ShieldClientConfig) Decrypt ¶
func (c *ShieldClientConfig) Decrypt() error
func (*ShieldClientConfig) Encrypt ¶
func (c *ShieldClientConfig) Encrypt() error
func (*ShieldClientConfig) Validate ¶
func (c *ShieldClientConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.