Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApiKeyCredential ¶
type ApiKeyCredential struct { In schema.APIKeyLocation Name string Value string // contains filtered or unexported fields }
APIKeyCredential presents an API key credential.
func NewApiKeyCredential ¶
func NewApiKeyCredential(client *http.Client, config *schema.APIKeyAuthConfig) (*ApiKeyCredential, error)
NewApiKeyCredential creates a new APIKeyCredential instance.
func (ApiKeyCredential) GetClient ¶
func (akc ApiKeyCredential) GetClient() *http.Client
GetClient gets the HTTP client that is compatible with the current credential.
func (ApiKeyCredential) Inject ¶
func (akc ApiKeyCredential) Inject(req *http.Request) (bool, error)
Inject the credential into the incoming request.
func (ApiKeyCredential) InjectMock ¶
func (akc ApiKeyCredential) InjectMock(req *http.Request) bool
InjectMock injects the mock credential into the incoming request for explain APIs.
type BasicCredential ¶
type BasicCredential struct { UserInfo *url.Userinfo Header string // contains filtered or unexported fields }
BasicCredential represents the basic authentication credential.
func NewBasicCredential ¶
func NewBasicCredential(client *http.Client, config *schema.BasicAuthConfig) (*BasicCredential, error)
NewBasicCredential creates a new BasicCredential instance.
func (BasicCredential) GetClient ¶
func (bc BasicCredential) GetClient() *http.Client
GetClient gets the HTTP client that is compatible with the current credential.
func (BasicCredential) Inject ¶
func (bc BasicCredential) Inject(req *http.Request) (bool, error)
Inject the credential into the incoming request.
func (BasicCredential) InjectMock ¶
func (bc BasicCredential) InjectMock(req *http.Request) bool
InjectMock injects the mock credential into the incoming request for explain APIs.
type CookieCredential ¶
type CookieCredential struct {
// contains filtered or unexported fields
}
CookieCredential presents a cookie credential.
func NewCookieCredential ¶
func NewCookieCredential(client *http.Client) (*CookieCredential, error)
NewCookieCredential creates a new CookieCredential instance.
func (CookieCredential) GetClient ¶
func (cc CookieCredential) GetClient() *http.Client
GetClient gets the HTTP client that is compatible with the current credential.
func (CookieCredential) Inject ¶
func (cc CookieCredential) Inject(req *http.Request) (bool, error)
Inject the credential into the incoming request.
func (CookieCredential) InjectMock ¶
func (cc CookieCredential) InjectMock(req *http.Request) bool
InjectMock injects the mock credential into the incoming request for explain APIs.
type Credential ¶
type Credential interface { // GetClient gets the HTTP client that is compatible with the current credential. GetClient() *http.Client // Inject the credential into the incoming request. Inject(request *http.Request) (bool, error) // InjectMock injects the mock credential into the incoming request for explain APIs. InjectMock(request *http.Request) bool }
Credential abstracts an authentication credential interface.
func NewCredential ¶
func NewCredential(ctx context.Context, httpClient *http.Client, baseServerURL *url.URL, security schema.SecurityScheme) (Credential, bool, error)
NewCredential creates a generic credential from the security scheme.
type HTTPCredential ¶
type HTTPCredential struct { Header string Scheme string Value string // contains filtered or unexported fields }
HTTPCredential presents a header authentication credential.
func NewHTTPCredential ¶
func NewHTTPCredential(client *http.Client, config *schema.HTTPAuthConfig) (*HTTPCredential, error)
NewHTTPCredential creates a new HTTPCredential instance.
func (HTTPCredential) GetClient ¶
func (hc HTTPCredential) GetClient() *http.Client
GetClient gets the HTTP client that is compatible with the current credential.
func (HTTPCredential) Inject ¶
func (hc HTTPCredential) Inject(req *http.Request) (bool, error)
Inject the credential into the incoming request.
func (HTTPCredential) InjectMock ¶
func (hc HTTPCredential) InjectMock(req *http.Request) bool
InjectMock injects the mock credential into the incoming request for explain APIs.
type NoopCredential ¶
type NoopCredential struct {
// contains filtered or unexported fields
}
NoopCredential implements a no-op credential.
func NewNoopCredential ¶
func NewNoopCredential(client *http.Client) *NoopCredential
NewNoopCredential creates a new NoopCredential instance.
func (NoopCredential) GetClient ¶
func (cc NoopCredential) GetClient() *http.Client
GetClient gets the HTTP client that is compatible with the current credential.
func (NoopCredential) Inject ¶
func (cc NoopCredential) Inject(req *http.Request) (bool, error)
Inject the credential into the incoming request.
func (NoopCredential) InjectMock ¶
func (cc NoopCredential) InjectMock(req *http.Request) bool
InjectMock injects the mock credential into the incoming request for explain APIs.
type OAuth2Client ¶
type OAuth2Client struct {
// contains filtered or unexported fields
}
OAuth2Client represent the client of the OAuth2 client credentials.
func NewOAuth2Client ¶
func NewOAuth2Client(ctx context.Context, httpClient *http.Client, baseServerURL *url.URL, flowType schema.OAuthFlowType, config *schema.OAuthFlow) (*OAuth2Client, error)
NewOAuth2Client creates an OAuth2 client from the security scheme.
func (OAuth2Client) GetClient ¶
func (oc OAuth2Client) GetClient() *http.Client
GetClient gets the HTTP client that is compatible with the current credential.
func (OAuth2Client) Inject ¶
func (oc OAuth2Client) Inject(req *http.Request) (bool, error)
Inject the credential into the incoming request.
func (OAuth2Client) InjectMock ¶
func (oc OAuth2Client) InjectMock(req *http.Request) bool
InjectMock injects the mock credential into the incoming request for explain APIs.