add user impersonation via username and password.
This commit is contained in:
@ -77,7 +77,13 @@ func (req *Request) Do() error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not construct http request: %s", err)
|
||||
}
|
||||
httpreq.Header.Set("Authorization", req.CW.Auth)
|
||||
if req.CW.AuthAPIKey != "" {
|
||||
httpreq.Header.Set("Authorization", req.CW.AuthAPIKey)
|
||||
} else { //User impersonation
|
||||
httpreq.Header.Set("Cookie", fmt.Sprintf("companyName=%s", req.CW.CompanyName))
|
||||
httpreq.Header.Set("Cookie", fmt.Sprintf("memberHash=%s", req.CW.AuthMemberHash))
|
||||
httpreq.Header.Set("Cookie", fmt.Sprintf("MemberID=%s", req.CW.AuthUsername))
|
||||
}
|
||||
httpreq.Header.Set("Content-Type", "application/json")
|
||||
resp, err := client.Do(httpreq)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user