function _services_authenticate_user in Services 7.3
Run enabled authentication plugins.
Plugin that authenticate user will change global $user.
1 call to _services_authenticate_user()
- _services_controller_execute_internals in includes/
services.runtime.inc - Internals of the services_controller_execute().
File
- includes/
services.runtime.inc, line 423 - Contains functions that only are necessary when a service call is made. This has broken out so that this code isn't loaded for every page load.
Code
function _services_authenticate_user($controller, $endpoint, $args, $options) {
if (empty($endpoint->authentication)) {
return NULL;
}
if (!isset($options['skip_authentication']) || !$options['skip_authentication']) {
foreach ($endpoint->authentication as $auth_module => $auth_settings) {
if (!empty($auth_settings)) {
// Add in the auth module's endpoint settings if present.
if (isset($controller['endpoint'][$auth_module])) {
if (is_array($auth_settings)) {
$auth_settings += $controller['endpoint'][$auth_module];
}
}
if ($auth_error = services_auth_invoke($auth_module, 'authenticate_call', $auth_settings, $controller, $args)) {
return services_error($auth_error, 401);
}
}
}
}
}