mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-04-19 14:10:14 +00:00
Add option for auth hook optionality - patch from Wolfgang Herget.
This commit is contained in:
parent
1ff298c42b
commit
a4aedbef05
@ -162,6 +162,9 @@ $c->collections_always_exist = false;
|
||||
* and he used to authenticate the user should be at least 'password,user_no'
|
||||
* awl/inc/AuthPlugins.php is a sample file not used by showing what could be
|
||||
* a hook
|
||||
*
|
||||
* $c->authenticate_hook['optional'] = true; can be set to try default authentication
|
||||
* as well in case the configured hook should report a failure.
|
||||
*/
|
||||
|
||||
/********************************/
|
||||
|
||||
@ -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) ) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user