Skip to content

Commit

Permalink
imperva: api keys from body to headers
Browse files Browse the repository at this point in the history
  • Loading branch information
robert lestak committed Jun 3, 2024
1 parent 9a1249c commit 9cc36bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stores/incapsula/incapsula.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ func (s *IncapsulaStore) UploadIncapsulaCert(cert *tlssecret.Certificate) error
c := http.Client{}
iurl := os.Getenv("INCAPSULA_API") + "/sites/customCertificate/upload"
data := url.Values{}
data.Set("api_id", s.ID)
data.Set("site_id", s.SiteID)
data.Set("api_key", s.Key)
data.Set("certificate", bCert)
data.Set("private_key", bKey)
d := strings.NewReader(data.Encode())
Expand All @@ -89,6 +87,8 @@ func (s *IncapsulaStore) UploadIncapsulaCert(cert *tlssecret.Certificate) error
l.WithError(rerr).Errorf("http.NewRequest error")
return rerr
}
req.Header.Set("x-api-id", s.ID)
req.Header.Set("x-api-key", s.Key)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
res, serr := c.Do(req)
if serr != nil {
Expand Down Expand Up @@ -127,9 +127,7 @@ func (s *IncapsulaStore) GetIncapsulaSiteStatus() (string, error) {
iurl := os.Getenv("INCAPSULA_API") + "/sites/status"
c := http.Client{}
data := url.Values{}
data.Set("api_id", s.ID)
data.Set("site_id", s.SiteID)
data.Set("api_key", s.Key)
data.Set("tests", "services")
d := strings.NewReader(data.Encode())
l.Debugf("url=%s data=%s", iurl, data.Encode())
Expand All @@ -138,6 +136,8 @@ func (s *IncapsulaStore) GetIncapsulaSiteStatus() (string, error) {
l.WithError(rerr).Errorf("http.NewRequest error")
return "", rerr
}
req.Header.Set("x-api-id", s.ID)
req.Header.Set("x-api-key", s.Key)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
res, serr := c.Do(req)
if serr != nil {
Expand Down

0 comments on commit 9cc36bb

Please sign in to comment.