You are here

function restful_get_authentication_handler in RESTful 7

Return the authentication handler based on the authentication plugin name.

Parameters

string $auth_plugin_name: Name of the authentication plugin.

Return value

\RestfulAuthenticationInterface The authentication provider object.

Throws

\RestfulException if the authentication provider does not exist.

2 calls to restful_get_authentication_handler()
RestfulAuthenticationTestCase::testAuthentication in tests/RestfulAuthenticationTestCase.test
Test authenticating a user.
restful_get_restful_handler_by_name in ./restful.module
Return the handler based on major and minor version, and resource name.

File

./restful.module, line 335

Code

function restful_get_authentication_handler($auth_plugin_name) {
  $auth_plugin = restful_get_authentication_plugin($auth_plugin_name);
  if (!($auth_class = ctools_plugin_get_class($auth_plugin, 'class'))) {
    throw new \RestfulServiceUnavailable(format_string('Authentication plugin class (@plugin) was not found.', array(
      '@plugin' => $auth_plugin_name,
    )));
  }
  return new $auth_class($auth_plugin);
}