openid.install

  1. 7.x drupal-7.x/modules/openid/openid.install
  2. 6.x drupal-6.x/modules/openid/openid.install

File

drupal-6.x/modules/openid/openid.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_install().
  4. */
  5. function openid_install() {
  6. // Create table.
  7. drupal_install_schema('openid');
  8. }
  9. /**
  10. * Implementation of hook_uninstall().
  11. */
  12. function openid_uninstall() {
  13. // Remove table.
  14. drupal_uninstall_schema('openid');
  15. }
  16. /**
  17. * Implementation of hook_schema().
  18. */
  19. function openid_schema() {
  20. $schema['openid_association'] = array(
  21. 'description' => 'Stores temporary shared key association information for OpenID authentication.',
  22. 'fields' => array(
  23. 'idp_endpoint_uri' => array(
  24. 'type' => 'varchar',
  25. 'length' => 255,
  26. 'not null' => TRUE,
  27. 'description' => 'Primary Key: URI of the OpenID Provider endpoint.',
  28. ),
  29. 'assoc_handle' => array(
  30. 'type' => 'varchar',
  31. 'length' => 255,
  32. 'not null' => TRUE,
  33. 'description' => 'Used to refer to this association in subsequent messages.',
  34. ),
  35. 'assoc_type' => array(
  36. 'type' => 'varchar',
  37. 'length' => 32,
  38. 'description' => 'The signature algorithm used: one of HMAC-SHA1 or HMAC-SHA256.',
  39. ),
  40. 'session_type' => array(
  41. 'type' => 'varchar',
  42. 'length' => 32,
  43. 'description' => 'Valid association session types: "no-encryption", "DH-SHA1", and "DH-SHA256".',
  44. ),
  45. 'mac_key' => array(
  46. 'type' => 'varchar',
  47. 'length' => 255,
  48. 'description' => 'The MAC key (shared secret) for this association.',
  49. ),
  50. 'created' => array(
  51. 'type' => 'int',
  52. 'not null' => TRUE,
  53. 'default' => 0,
  54. 'description' => 'UNIX timestamp for when the association was created.',
  55. ),
  56. 'expires_in' => array(
  57. 'type' => 'int',
  58. 'not null' => TRUE,
  59. 'default' => 0,
  60. 'description' => 'The lifetime, in seconds, of this association.',
  61. ),
  62. ),
  63. 'primary key' => array('idp_endpoint_uri'),
  64. 'unique keys' => array(
  65. 'assoc_handle' => array('assoc_handle'),
  66. ),
  67. );
  68. $schema['openid_nonce'] = array(
  69. 'description' => 'Stores received openid.response_nonce per OpenID endpoint URL to prevent replay attacks.',
  70. 'fields' => array(
  71. 'idp_endpoint_uri' => array(
  72. 'type' => 'varchar',
  73. 'length' => 255,
  74. 'description' => 'URI of the OpenID Provider endpoint.',
  75. ),
  76. 'nonce' => array(
  77. 'type' => 'varchar',
  78. 'length' => 255,
  79. 'description' => 'The value of openid.response_nonce'
  80. ),
  81. 'expires' => array(
  82. 'type' => 'int',
  83. 'not null' => TRUE,
  84. 'default' => 0,
  85. 'description' => 'A Unix timestamp indicating when the entry should expire.',
  86. ),
  87. ),
  88. 'indexes' => array(
  89. 'nonce' => array('nonce'),
  90. 'expires' => array('expires'),
  91. ),
  92. );
  93. return $schema;
  94. }
  95. /**
  96. * @addtogroup updates-6.x-extra
  97. * @{
  98. */
  99. /**
  100. * Add the openid_nonce table.
  101. *
  102. * Implementation of hook_update_N().
  103. */
  104. function openid_update_6000() {
  105. $ret = array();
  106. $schema['openid_nonce'] = array(
  107. 'description' => 'Stores received openid.response_nonce per OpenID endpoint URL to prevent replay attacks.',
  108. 'fields' => array(
  109. 'idp_endpoint_uri' => array(
  110. 'type' => 'varchar',
  111. 'length' => 255,
  112. 'description' => 'URI of the OpenID Provider endpoint.',
  113. ),
  114. 'nonce' => array(
  115. 'type' => 'varchar',
  116. 'length' => 255,
  117. 'description' => 'The value of openid.response_nonce'
  118. ),
  119. 'expires' => array(
  120. 'type' => 'int',
  121. 'not null' => TRUE,
  122. 'default' => 0,
  123. 'description' => 'A Unix timestamp indicating when the entry should expire.',
  124. ),
  125. ),
  126. 'indexes' => array(
  127. 'nonce' => array('nonce'),
  128. 'expires' => array('expires'),
  129. ),
  130. );
  131. db_create_table($ret, 'openid_nonce', $schema['openid_nonce']);
  132. return $ret;
  133. }
  134. /**
  135. * Bind associations to their providers.
  136. */
  137. function openid_update_6001() {
  138. $ret = array();
  139. db_drop_table($ret, 'openid_association');
  140. $schema['openid_association'] = array(
  141. 'description' => 'Stores temporary shared key association information for OpenID authentication.',
  142. 'fields' => array(
  143. 'idp_endpoint_uri' => array(
  144. 'type' => 'varchar',
  145. 'length' => 255,
  146. 'not null' => TRUE,
  147. 'description' => 'Primary Key: URI of the OpenID Provider endpoint.',
  148. ),
  149. 'assoc_handle' => array(
  150. 'type' => 'varchar',
  151. 'length' => 255,
  152. 'not null' => TRUE,
  153. 'description' => 'Used to refer to this association in subsequent messages.',
  154. ),
  155. 'assoc_type' => array(
  156. 'type' => 'varchar',
  157. 'length' => 32,
  158. 'description' => 'The signature algorithm used: one of HMAC-SHA1 or HMAC-SHA256.',
  159. ),
  160. 'session_type' => array(
  161. 'type' => 'varchar',
  162. 'length' => 32,
  163. 'description' => 'Valid association session types: "no-encryption", "DH-SHA1", and "DH-SHA256".',
  164. ),
  165. 'mac_key' => array(
  166. 'type' => 'varchar',
  167. 'length' => 255,
  168. 'description' => 'The MAC key (shared secret) for this association.',
  169. ),
  170. 'created' => array(
  171. 'type' => 'int',
  172. 'not null' => TRUE,
  173. 'default' => 0,
  174. 'description' => 'UNIX timestamp for when the association was created.',
  175. ),
  176. 'expires_in' => array(
  177. 'type' => 'int',
  178. 'not null' => TRUE,
  179. 'default' => 0,
  180. 'description' => 'The lifetime, in seconds, of this association.',
  181. ),
  182. ),
  183. 'primary key' => array('idp_endpoint_uri'),
  184. 'unique keys' => array(
  185. 'assoc_handle' => array('assoc_handle'),
  186. ),
  187. );
  188. db_create_table($ret, 'openid_association', $schema['openid_association']);
  189. return $ret;
  190. }
  191. /**
  192. * @} End of "addtogroup updates-6.x-extra".
  193. * The next series of updates should start at 7000.
  194. */