server/src/app/Libraries/Handle/HandleClient.php
changeset 387 7fba86fa8604
parent 326 226d5b17a119
child 552 2c579ea45608
equal deleted inserted replaced
386:c731ab9b934d 387:7fba86fa8604
   178                 'Content-Type' => 'application/json;charset=UTF-8',
   178                 'Content-Type' => 'application/json;charset=UTF-8',
   179                 'Authorization' => $this->createAuthorisationHeaderFromJson($jsonResp)
   179                 'Authorization' => $this->createAuthorisationHeaderFromJson($jsonResp)
   180             ];
   180             ];
   181             # Send the request again with a valid correctly signed Authorization header
   181             # Send the request again with a valid correctly signed Authorization header
   182             $sessionResp = $this->httpClient->put($url.'this', ['headers' => $pkheaders, 'verify' => false]);
   182             $sessionResp = $this->httpClient->put($url.'this', ['headers' => $pkheaders, 'verify' => false]);
   183             Log::debug('Create session with auth: '.$sessionResp->getStatusCode().' : '.$sessionResp->getReasonPhrase());
   183 
   184 
   184 
   185             $jsonResp = json_decode($sessionResp->getBody(), true);
   185             $jsonResp = json_decode($sessionResp->getBody(), true);
       
   186             Log::debug('Create session with auth: '.$sessionResp->getStatusCode().' : '.$sessionResp->getReasonPhrase(). " with body : \n".$sessionResp->getBody());
   186 
   187 
   187             $this->session = $jsonResp['authenticated']?$jsonResp['sessionId']:"";
   188             $this->session = $jsonResp['authenticated']?$jsonResp['sessionId']:"";
   188             $headers['Authorization'] = "Handle version=\"0\", sessionId=\"$this->session\"";
   189             $headers['Authorization'] = "Handle version=\"0\", sessionId=\"$this->session\"";
   189 
   190 
   190         }
   191         }