You are here

function cas_schema in CAS 8

Same name and namespace in other branches
  1. 6.3 cas.install \cas_schema()
  2. 7 cas.install \cas_schema()
  3. 2.x cas.install \cas_schema()

Implements hook_schema().

File

./cas.install, line 13
The Drupal install file.

Code

function cas_schema() {
  $schema = [];
  $schema['cas_login_data'] = [
    'description' => "Store CAS login data for single sign out purposes.",
    'fields' => [
      'sid' => [
        'description' => "A session ID (hashed). The value is generated by Drupal's session handlers.",
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'plainsid' => [
        'description' => 'An unhashed session ID.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'ticket' => [
        'description' => "A CAS service ticket.",
        'type' => 'varchar',
        'length' => 256,
        'not null' => TRUE,
        'default' => '',
      ],
      'created' => [
        'description' => 'The timestamp when this user session was created.',
        'type' => 'int',
        'length' => 11,
        'not null' => TRUE,
      ],
    ],
    'primary key' => [
      'sid',
    ],
    'indexes' => [
      'ticket' => [
        'sid',
      ],
    ],
    'foreign keys' => [
      'session_user' => [
        'table' => 'session',
        'columns' => [
          'sid' => 'sid',
        ],
      ],
    ],
  ];
  $schema['cas_pgt_storage'] = [
    // Database table for storing PGT/PGTIOU relationships.
    'description' => 'Stores PGT/PGTIOU relationships.',
    'fields' => [
      'pgt_iou' => [
        'description' => 'PGTIOU is the key returned from the CAS server for the PGT',
        'type' => 'varchar_ascii',
        'length' => 256,
        'not null' => TRUE,
      ],
      'pgt' => [
        'description' => 'The actual ProxyGrantingTicket value.',
        'type' => 'varchar_ascii',
        'length' => 256,
        'not null' => TRUE,
      ],
      'timestamp' => [
        'description' => 'Created time. Used to delete unused, stale PGTs',
        'type' => 'int',
        'not null' => TRUE,
      ],
    ],
    'unique keys' => [
      'pgtiou_pgt' => [
        'pgt_iou',
        'pgt',
      ],
    ],
    'primary key' => [
      'pgt_iou',
    ],
  ];
  return $schema;
}