You are here

function saml_sp_schema in SAML Service Provider 7.3

Same name and namespace in other branches
  1. 7.8 saml_sp.install \saml_sp_schema()
  2. 7 saml_sp.install \saml_sp_schema()
  3. 7.2 saml_sp.install \saml_sp_schema()

Implements hook_schema().

File

./saml_sp.install, line 12
Hook_requirements for the SAML Service Provider module.

Code

function saml_sp_schema() {
  $schema = array();

  // Store the IDP data.
  $schema['saml_sp_idps'] = array(
    'description' => 'IDPs registered with SAML Service Provider.',
    // Enable CTools exportables based on this table.
    'export' => array(
      // SAML IDP machine name key.
      'key' => 'machine_name',
      // In the export, entries will be identified as $idp
      'export' => 'idp',
      // Description of key.
      'key name' => 'IDP machine name',
      // Variable name to use in exported code.
      'identifier' => 'saml_idp',
      // // Use the environment load callback directly.
      // 'load callback' => 'apachesolr_environment_load',
      // // Thin wrapper for the environment save callback.
      // 'save callback' => 'apachesolr_ctools_environment_save',
      // // Thin wrapper for the environment delete callback.
      // 'delete callback' => 'apachesolr_ctools_environment_delete',
      // // Includes the environment variables in 'conf' as well as the fields in this table.
      // 'export callback' => 'apachesolr_ctools_environment_export',
      // Use the same hook as the API name below.
      'default hook' => 'saml_sp_default_idps',
      // CTools API implementation.
      'api' => array(
        'owner' => 'saml_sp',
        // Base name for API files: foo.saml_sp_idps.inc
        'api' => 'saml_sp_idps',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'machine_name' => array(
        'description' => 'Unique identifier for the environment',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Human-readable name for the SAML IDP',
        'type' => 'varchar',
        'length' => 30,
        'not null' => TRUE,
        'default' => '',
      ),
      'app_name' => array(
        'description' => 'Human-readable name to provide to the IDP to identify the application',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The entityID of the Identity Provider, possibly a URL',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'nameid_field' => array(
        'description' => 'Name of the fields where NameID is stored',
        'type' => 'varchar',
        'length' => 30,
        'not null' => TRUE,
        'default' => '',
      ),
      'login_url' => array(
        'description' => 'Full url to connect to the SAML login endpoint',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'logout_url' => array(
        'description' => 'Full url to connect to the SAML logout endpoint',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'x509_certs' => array(
        'description' => 'The x.509 public certificates of the IDP',
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'authn_context_class_ref' => array(
        'description' => 'Preferred authentication method.',
        'type' => 'varchar',
        'length' => '100',
        'not null' => TRUE,
        'default' => 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport',
      ),
    ),
    'primary key' => array(
      'machine_name',
    ),
  );
  $schema['saml_sp_requests'] = array(
    'description' => 'temporary store for SAMl requests',
    'fields' => array(
      'id' => array(
        'description' => 'Request ID',
        'type' => 'varchar',
        'length' => '60',
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'serialized data comtaining the information for the request',
        'type' => 'blob',
        'not null' => FALSE,
      ),
      'expires' => array(
        'description' => 'when the data needs to be removed if not done before',
        'type' => 'int',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}