Add option for auth hook optionality - patch from Wolfgang Herget.

This commit is contained in:
Andrew McMillan committed 2009-10-06 18:17:17 +13:00
1 parent 1ff298c42b
commit a4aedbef05
2 files changed
+12 -1

No files matched your search

+9 -1
View File
@@ -221,7 +221,15 @@ class HTTPAuthSession {
* It can expect that:
* - Configuration data will be in $c->authenticate_hook['config'], which might be an array, or whatever is needed.
*/
return call_user_func( $c->authenticate_hook['call'], $username, $password );
$hook_response = call_user_func( $c->authenticate_hook['call'], $username, $password );
/**
* make the authentication hook optional: if the flag is set, ignore a return value of 'false'
*/
if (isset($c->authenticate_hook['optional']) && $c->authenticate_hook['optional']) {
if ($hook_response !== false) { return $hook_response; }
} else {
return $hook_response;
}
}
if ( $usr = getUserByName($username) ) {