'Stores temporary shared key association information for OpenID authentication.', 'fields' => array( 'idp_endpoint_uri' => array( 'type' => 'varchar', 'length' => 255, 'description' => 'URI of the OpenID Provider endpoint.', ), 'assoc_handle' => array( 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => 'Primary Key: Used to refer to this association in subsequent messages.', ), 'assoc_type' => array( 'type' => 'varchar', 'length' => 32, 'description' => 'The signature algorithm used: one of HMAC-SHA1 or HMAC-SHA256.', ), 'session_type' => array( 'type' => 'varchar', 'length' => 32, 'description' => 'Valid association session types: "no-encryption", "DH-SHA1", and "DH-SHA256".', ), 'mac_key' => array( 'type' => 'varchar', 'length' => 255, 'description' => 'The MAC key (shared secret) for this association.', ), 'created' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => 'UNIX timestamp for when the association was created.', ), 'expires_in' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => 'The lifetime, in seconds, of this association.', ), ), 'primary key' => array('assoc_handle'), ); $schema['openid_identities'] = array( 'description' => 'Stores OpenID authentication mapping.', 'fields' => array( 'aid' => array( 'description' => 'Primary Key: Unique authmap ID.', 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'uid' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => "User's {users}.uid.", ), 'identifier' => array( 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '', 'description' => 'Unique OpenID identifier.', ), ), 'unique keys' => array( 'identifier' => array('identifier'), ), 'primary key' => array('aid'), 'foreign keys' => array( 'user' => array( 'table' => 'users', 'columns' => array('uid' => 'uid'), ), ), ); $schema['openid_nonce'] = array( 'description' => 'Stores received openid.response_nonce per OpenID endpoint URL to prevent replay attacks.', 'fields' => array( 'idp_endpoint_uri' => array( 'type' => 'varchar', 'length' => 255, 'description' => 'URI of the OpenID Provider endpoint.', ), 'nonce' => array( 'type' => 'varchar', 'length' => 255, 'description' => 'The value of openid.response_nonce.', ), 'expires' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => 'A Unix timestamp indicating when the entry should expire.', ), ), 'indexes' => array( 'nonce' => array('nonce'), 'expires' => array('expires'), ), ); return $schema; } /** * Implements hook_requirements(). */ function openid_requirements($phase) { $requirements = array(); if ($phase == 'runtime') { // Check for the PHP BC Math library. if (!function_exists('bcadd') && !function_exists('gmp_add')) { $requirements['openid_math'] = array( 'value' => t('Not installed'), 'severity' => REQUIREMENT_ERROR, 'description' => t('OpenID suggests the use of either the GMP Math (recommended for performance) or BC Math libraries to enable OpenID associations.', array('@gmp' => 'http://php.net/manual/book.gmp.php', '@bc' => 'http://www.php.net/manual/book.bc.php')), ); } elseif (!function_exists('gmp_add')) { $requirements['openid_math'] = array( 'value' => t('Not optimized'), 'severity' => REQUIREMENT_WARNING, 'description' => t('OpenID suggests the use of the GMP Math library for PHP for optimal performance. Check the GMP Math Library documentation for installation instructions.', array('@url' => 'http://www.php.net/manual/book.gmp.php')), ); } else { $requirements['openid_math'] = array( 'value' => t('Installed'), ); } $requirements['openid_math']['title'] = t('OpenID Math library'); } return $requirements; } /** * Implements hook_update_last_removed(). */ function openid_update_last_removed() { return 6000; } /** * @addtogroup updates-7.x-to-8.x * @{ */ /** * Moves xri_proxy_resolver settings from variable to config. * * @ingroup config_upgrade */ function openid_update_8001() { update_variables_to_config('openid.settings', array( 'xri_proxy_resolver' => 'xri_proxy_resolver', )); } /** * Move authentication mapping to an OpenID managed table. */ function openid_update_8002() { $schema['openid_identities'] = array( 'description' => 'Stores OpenID authentication mapping.', 'fields' => array( 'aid' => array( 'description' => 'Primary Key: Unique authmap ID.', 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'uid' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => "User's {users}.uid.", ), 'identifier' => array( 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '', 'description' => 'Unique OpenID identifier.', ), ), 'unique keys' => array( 'identifier' => array('identifier'), ), 'primary key' => array('aid'), 'foreign keys' => array( 'user' => array( 'table' => 'users', 'columns' => array('uid' => 'uid'), ), ), ); db_create_table('openid_identities', $schema['openid_identities']); // Migrate entries from {authmap} to {openid_identities}. $query = db_select('authmap', 'a') ->condition('module', 'openid'); $query->addField('a', 'uid'); $query->addField('a', 'authname', 'identifier'); db_insert('openid_identities') ->from($query) ->execute(); // Remove old entries in {authmap}. db_delete('authmap') ->condition('module', 'openid') ->execute(); } /** * @} End of "addtogroup updates-7.x-to-8.x". */