Newer
Older
<?php
/**
* Implementation of hook_install().
*/
function openid_install() {
// Create table.
drupal_install_schema('openid');
}
/**
* Implementation of hook_uninstall().
*/
function openid_uninstall() {
// Remove table.
drupal_uninstall_schema('openid');
}
Dries Buytaert
committed
/**
* Implementation of hook_schema().
*/
function openid_schema() {
$schema['openid_association'] = array(
Gábor Hojtsy
committed
'description' => 'Stores temporary shared key association information for OpenID authentication.',
Dries Buytaert
committed
'fields' => array(
'idp_endpoint_uri' => array(
'type' => 'varchar',
'length' => 255,
Gábor Hojtsy
committed
'description' => 'URI of the OpenID Provider endpoint.',
),
'assoc_handle' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
Gábor Hojtsy
committed
'description' => 'Primary Key: Used to refer to this association in subsequent messages.',
),
'assoc_type' => array(
'type' => 'varchar',
'length' => 32,
Gábor Hojtsy
committed
'description' => 'The signature algorithm used: one of HMAC-SHA1 or HMAC-SHA256.',
),
'session_type' => array(
'type' => 'varchar',
'length' => 32,
Gábor Hojtsy
committed
'description' => 'Valid association session types: "no-encryption", "DH-SHA1", and "DH-SHA256".',
),
'mac_key' => array(
'type' => 'varchar',
'length' => 255,
Gábor Hojtsy
committed
'description' => 'The MAC key (shared secret) for this association.',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
Gábor Hojtsy
committed
'description' => 'UNIX timestamp for when the association was created.',
),
'expires_in' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
Gábor Hojtsy
committed
'description' => 'The lifetime, in seconds, of this association.',
Dries Buytaert
committed
),
'primary key' => array('assoc_handle'),
);
$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'),
),
);
Dries Buytaert
committed
return $schema;
}
* @addtogroup updates-6.x-extra
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
* @{
*/
/**
* Add the openid_nonce table.
*
* Implementation of hook_update_N().
*/
function openid_update_6000() {
$ret = array();
$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'),
),
);
db_create_table($ret, 'openid_nonce', $schema['openid_nonce']);
return $ret;
}
/**
* @} End of "addtogroup updates-6.x-extra".