openid.install

Archivo

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. 'description' => 'URI of the OpenID Provider endpoint.',
  27. ),
  28. 'assoc_handle' => array(
  29. 'type' => 'varchar',
  30. 'length' => 255,
  31. 'not null' => TRUE,
  32. 'description' => 'Primary Key: Used to refer to this association in subsequent messages.',
  33. ),
  34. 'assoc_type' => array(
  35. 'type' => 'varchar',
  36. 'length' => 32,
  37. 'description' => 'The signature algorithm used: one of HMAC-SHA1 or HMAC-SHA256.',
  38. ),
  39. 'session_type' => array(
  40. 'type' => 'varchar',
  41. 'length' => 32,
  42. 'description' => 'Valid association session types: "no-encryption", "DH-SHA1", and "DH-SHA256".',
  43. ),
  44. 'mac_key' => array(
  45. 'type' => 'varchar',
  46. 'length' => 255,
  47. 'description' => 'The MAC key (shared secret) for this association.',
  48. ),
  49. 'created' => array(
  50. 'type' => 'int',
  51. 'not null' => TRUE,
  52. 'default' => 0,
  53. 'description' => 'UNIX timestamp for when the association was created.',
  54. ),
  55. 'expires_in' => array(
  56. 'type' => 'int',
  57. 'not null' => TRUE,
  58. 'default' => 0,
  59. 'description' => 'The lifetime, in seconds, of this association.',
  60. ),
  61. ),
  62. 'primary key' => array('assoc_handle'),
  63. );
  64. $schema['openid_nonce'] = array(
  65. 'description' => 'Stores received openid.response_nonce per OpenID endpoint URL to prevent replay attacks.',
  66. 'fields' => array(
  67. 'idp_endpoint_uri' => array(
  68. 'type' => 'varchar',
  69. 'length' => 255,
  70. 'description' => 'URI of the OpenID Provider endpoint.',
  71. ),
  72. 'nonce' => array(
  73. 'type' => 'varchar',
  74. 'length' => 255,
  75. 'description' => 'The value of openid.response_nonce'
  76. ),
  77. 'expires' => array(
  78. 'type' => 'int',
  79. 'not null' => TRUE,
  80. 'default' => 0,
  81. 'description' => 'A Unix timestamp indicating when the entry should expire.',
  82. ),
  83. ),
  84. 'indexes' => array(
  85. 'nonce' => array('nonce'),
  86. 'expires' => array('expires'),
  87. ),
  88. );
  89. return $schema;
  90. }
  91. /**
  92. * @addtogroup updates-6.x-extra
  93. * @{
  94. */
  95. /**
  96. * Add the openid_nonce table.
  97. *
  98. * Implementation of hook_update_N().
  99. */
  100. function openid_update_6000() {
  101. $ret = array();
  102. $schema['openid_nonce'] = array(
  103. 'description' => 'Stores received openid.response_nonce per OpenID endpoint URL to prevent replay attacks.',
  104. 'fields' => array(
  105. 'idp_endpoint_uri' => array(
  106. 'type' => 'varchar',
  107. 'length' => 255,
  108. 'description' => 'URI of the OpenID Provider endpoint.',
  109. ),
  110. 'nonce' => array(
  111. 'type' => 'varchar',
  112. 'length' => 255,
  113. 'description' => 'The value of openid.response_nonce'
  114. ),
  115. 'expires' => array(
  116. 'type' => 'int',
  117. 'not null' => TRUE,
  118. 'default' => 0,
  119. 'description' => 'A Unix timestamp indicating when the entry should expire.',
  120. ),
  121. ),
  122. 'indexes' => array(
  123. 'nonce' => array('nonce'),
  124. 'expires' => array('expires'),
  125. ),
  126. );
  127. db_create_table($ret, 'openid_nonce', $schema['openid_nonce']);
  128. return $ret;
  129. }
  130. /**
  131. * @} End of "addtogroup updates-6.x-extra".
  132. * The next series of updates should start at 7000.
  133. */

Functions

Nombreorden descendente Descripción
openid_install Implementation of hook_install().
openid_schema Implementation of hook_schema().
openid_uninstall Implementation of hook_uninstall().
openid_update_6000 Add the openid_nonce table.