Skip to content

Commit

Permalink
update auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan SOOS committed Mar 16, 2017
1 parent a9bae14 commit 820dc06
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Auth/SoapAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,21 @@ public function getToken($request = null)
/** @var \DOMDocument $dom */
$dom = $request->input('Cake\Utility\Xml::build', ['return' => 'domdocument']);

if (count($dom->getElementsByTagName($config['soapHeader']['username'])) > 0){
if (count($dom->getElementsByTagName($config['soapHeader']['username'])) > 0 &&
isset($dom->getElementsByTagName($config['soapHeader']['username'])[0]) &&
$dom->getElementsByTagName($config['soapHeader']['username'])[0] instanceof \DOMNode
){
$this->_username = $dom->getElementsByTagName($config['soapHeader']['username'])[0]->nodeValue;

}

if (count($dom->getElementsByTagName($config['soapHeader']['password'])) > 0){
if (count($dom->getElementsByTagName($config['soapHeader']['password'])) > 0 &&
isset($dom->getElementsByTagName($config['soapHeader']['password'])[0]) &&
$dom->getElementsByTagName($config['soapHeader']['password'])[0] instanceof \DOMNode){
$this->_password = $dom->getElementsByTagName($config['soapHeader']['password'])[0]->nodeValue;

}

if (!empty($this->_username) && !empty($this->_password)){
$this->_token = [
$config['fields']['username'] => $this->_username,
Expand Down

0 comments on commit 820dc06

Please sign in to comment.