You are here

public function RestfulAuthenticationBasic::applies in RESTful 7

Determines if the request can be checked for authentication. For example, when authenticating with HTTP header, return FALSE if the header values do not exist.

Parameters

array $request: The request.

string $method: The HTTP method. Defaults to "get".

Return value

bool TRUE if the request can be checked for authentication, FALSE otherwise.

Overrides RestfulAuthenticationBase::applies

File

plugins/authentication/RestfulAuthenticationBasic.class.php, line 13
Contains RestfulAuthenticationBasic

Class

RestfulAuthenticationBasic
@file Contains RestfulAuthenticationBasic

Code

public function applies(array $request = array(), $method = \RestfulInterface::GET) {
  if (variable_get('restful_skip_basic_auth', FALSE)) {

    // Skip basic auth. The variable may be set if .htaccess password is set
    // on the server.
    return;
  }
  list($username, $password) = $this
    ->getCredentials();
  return isset($username) && isset($password);
}