openid_verify_assertion

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/openid/openid.module, строка 488

Версии
6
openid_verify_assertion($op_endpoint, $response)

Attempt to verify the response received from the OpenID Provider.

Параметры

$op_endpoint The OpenID Provider URL.

$response Array of repsonse values from the provider.

Возвращаемое значение

boolean

▾ 1 функция вызывает openid_verify_assertion()

openid_complete in modules/openid/openid.module
Completes OpenID authentication by validating returned data from the OpenID Provider.

Код

<?php
function openid_verify_assertion($op_endpoint, $response) {
  module_load_include('inc', 'openid');

  $valid = FALSE;

  $association = db_fetch_object(db_query("SELECT * FROM {openid_association} WHERE assoc_handle = '%s'", $response['openid.assoc_handle']));
  if ($association && isset($association->session_type)) {
    $keys_to_sign = explode(',', $response['openid.signed']);
    $self_sig = _openid_signature($association, $response, $keys_to_sign);
    if ($self_sig == $response['openid.sig']) {
      $valid = TRUE;
    }
    else {
      $valid = FALSE;
    }
  }
  else {
    $request = $response;
    $request['openid.mode'] = 'check_authentication';
    $message = _openid_create_message($request);
    $headers = array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8');
    $result = drupal_http_request($op_endpoint, $headers, 'POST', _openid_encode_message($message));
    if (!isset($result->error)) {
      $response = _openid_parse_message($result->data);
      if (strtolower(trim($response['is_valid'])) == 'true') {
        $valid = TRUE;
      }
      else {
        $valid = FALSE;
      }
    }
  }
  return $valid;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему