You are here

function _services_keyauth_alter_browse_form in Services 6.2

Same name and namespace in other branches
  1. 7 auth/services_keyauth/services_keyauth.inc \_services_keyauth_alter_browse_form()

Alter service browser form to add required arguments for key authentication.

Parameters

$form: The services browser form.

$method: The method currently being browsed.

1 string reference to '_services_keyauth_alter_browse_form'
services_keyauth_authentication_info in auth/services_keyauth/services_keyauth.module
Implementation of hook_authentication_info().

File

auth/services_keyauth/services_keyauth.inc, line 143
The implementation of the key authentication scheme

Code

function _services_keyauth_alter_browse_form(&$form, $method) {
  foreach ($method['args'] as $key => $arg) {
    switch ($arg['name']) {
      case 'hash':
        $form['arg'][$key] = array(
          '#title' => t('Hash'),
          '#type' => 'textfield',
          '#value' => t('Gets generated after form submission'),
          '#disabled' => TRUE,
        );
        break;
      case 'sessid':
        $form['arg'][$key]['#title'] = t('Session ID');
        $form['arg'][$key]['#default_value'] = session_id();
        break;
      case 'domain_name':
        $form['arg'][$key]['#title'] = t('Domain name');
        $form['arg'][$key]['#default_value'] = $_SERVER['HTTP_HOST'];
        break;
      case 'domain_time_stamp':
        $form['arg'][$key] = array(
          '#title' => t('Timestamp'),
          '#type' => 'textfield',
          '#value' => t('Gets generated after form submission'),
          '#disabled' => TRUE,
        );
        break;
      case 'nonce':
        $form['arg'][$key]['#title'] = t('Nonce');
        $form['arg'][$key]['#value'] = user_password();
        break;
    }
  }
}