Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 26 deletions.
6 changes: 4 additions & 2 deletions src/Adapter/DbTable/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,10 @@ protected function authenticateQuerySelect(Sql\Select $dbSelect)
} catch (\Exception $e) {
throw new Exception\RuntimeException(
'The supplied parameters to DbTable failed to '
. 'produce a valid sql statement, please check table and column names '
. 'for validity.', 0, $e
. 'produce a valid sql statement, please check table and column names '
. 'for validity.',
0,
$e
);
}
return $resultIdentities;
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/DbTable/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
use Zend\Authentication\Adapter\Exception\ExceptionInterface as Exception;

interface ExceptionInterface extends Exception
{}
{
}
4 changes: 1 addition & 3 deletions src/Adapter/DbTable/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

use Zend\Authentication\Adapter\Exception;

class InvalidArgumentException
extends Exception\InvalidArgumentException
implements ExceptionInterface
class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface
{
}
3 changes: 2 additions & 1 deletion src/Adapter/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
use Zend\Authentication\Exception\ExceptionInterface as Exception;

interface ExceptionInterface extends Exception
{}
{
}
4 changes: 1 addition & 3 deletions src/Adapter/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

use Zend\Authentication\Exception;

class InvalidArgumentException
extends Exception\InvalidArgumentException
implements ExceptionInterface
class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface
{
}
10 changes: 5 additions & 5 deletions src/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ public function getResponse()
public function authenticate()
{
if (empty($this->request) || empty($this->response)) {
throw new Exception\RuntimeException('Request and Response objects must be set before calling '
. 'authenticate()');
throw new Exception\RuntimeException(
'Request and Response objects must be set before calling authenticate()'
);
}

if ($this->imaProxy) {
Expand Down Expand Up @@ -476,8 +477,8 @@ protected function _basicAuth($header)
}
if (empty($this->basicResolver)) {
throw new Exception\RuntimeException(
'A basicResolver object must be set before doing Basic '
. 'authentication');
'A basicResolver object must be set before doing Basic authentication'
);
}

// Decode the Authorization header
Expand Down Expand Up @@ -592,7 +593,6 @@ protected function _digestAuth($header)
// easier
$ha2 = hash('md5', $a2);


// Calculate the server's version of the request-digest. This must
// match $data['response']. See RFC 2617, section 3.2.2.1
$message = $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' . $ha2;
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/Http/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
* HTTP Auth Resolver Exception
*/
interface ExceptionInterface extends Exception
{}
{
}
10 changes: 6 additions & 4 deletions src/Adapter/Http/FileResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@ public function resolve($username, $realm, $password = null)
if (empty($username)) {
throw new Exception\InvalidArgumentException('Username is required');
} elseif (!ctype_print($username) || strpos($username, ':') !== false) {
throw new Exception\InvalidArgumentException('Username must consist only of printable characters, '
. 'excluding the colon');
throw new Exception\InvalidArgumentException(
'Username must consist only of printable characters, excluding the colon'
);
}
if (empty($realm)) {
throw new Exception\InvalidArgumentException('Realm is required');
} elseif (!ctype_print($realm) || strpos($realm, ':') !== false) {
throw new Exception\InvalidArgumentException('Realm must consist only of printable characters, '
. 'excluding the colon.');
throw new Exception\InvalidArgumentException(
'Realm must consist only of printable characters, excluding the colon.'
);
}

// Open file, read through looking for matching credentials
Expand Down
21 changes: 16 additions & 5 deletions src/Adapter/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ protected function getAuthorityName()
{
$options = $this->getLdap()->getOptions();
$name = $options['accountDomainName'];
if (!$name)
if (!$name) {
$name = $options['accountDomainNameShort'];
}

return $name ? $name : '';
}

Expand Down Expand Up @@ -220,8 +222,10 @@ public function authenticate()
$dname = '';

try {
if ($messages[1])
if ($messages[1]) {
$messages[] = $messages[1];
}

$messages[1] = '';
$messages[] = $this->optionsToString($options);

Expand Down Expand Up @@ -341,9 +345,16 @@ protected function prepareOptions(ZendLdap\Ldap $ldap, array $options)
switch ($key) {
case 'groupScope':
$value = (int) $value;
if (in_array($value, array(ZendLdap\Ldap::SEARCH_SCOPE_BASE,
ZendLdap\Ldap::SEARCH_SCOPE_ONE, ZendLdap\Ldap::SEARCH_SCOPE_SUB), true)) {
$adapterOptions[$key] = $value;
if (in_array(
$value,
array(
ZendLdap\Ldap::SEARCH_SCOPE_BASE,
ZendLdap\Ldap::SEARCH_SCOPE_ONE,
ZendLdap\Ldap::SEARCH_SCOPE_SUB,
),
true
)) {
$adapterOptions[$key] = $value;
}
break;
case 'memberIsDn':
Expand Down
3 changes: 2 additions & 1 deletion src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
namespace Zend\Authentication\Exception;

interface ExceptionInterface
{}
{
}

0 comments on commit 28ac5df

Please sign in to comment.