ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
Auth_OpenID_PostgreSQLStore Class Reference
+ Inheritance diagram for Auth_OpenID_PostgreSQLStore:
+ Collaboration diagram for Auth_OpenID_PostgreSQLStore:

Public Member Functions

 setSQL ()
 private More...
 
 _set_assoc ($server_url, $handle, $secret, $issued, $lifetime, $assoc_type)
 private More...
 
 blobEncode ($blob)
 private More...
 
 blobDecode ($blob)
 private More...
 
- Public Member Functions inherited from Auth_OpenID_SQLStore
 Auth_OpenID_SQLStore ($connection, $associations_table=null, $nonces_table=null)
 This creates a new SQLStore instance. More...
 
 tableExists ($table_name)
 
 isError ($value)
 Returns true if $value constitutes a database error; returns false otherwise. More...
 
 resultToBool ($obj)
 Converts a query result to a boolean. More...
 
 setSQL ()
 This method should be overridden by subclasses. More...
 
 reset ()
 Resets the store by removing all records from the store's tables. More...
 
 _verifySQL ()
 private More...
 
 _fixSQL ()
 private More...
 
 blobDecode ($blob)
 
 blobEncode ($str)
 
 createTables ()
 
 create_nonce_table ()
 
 create_assoc_table ()
 
 _set_assoc ($server_url, $handle, $secret, $issued, $lifetime, $assoc_type)
 private More...
 
 storeAssociation ($server_url, $association)
 
 _get_assoc ($server_url, $handle)
 private More...
 
 _get_assocs ($server_url)
 private More...
 
 removeAssociation ($server_url, $handle)
 
 getAssociation ($server_url, $handle=null)
 
 _add_nonce ($server_url, $timestamp, $salt)
 private More...
 
 useNonce ($server_url, $timestamp, $salt)
 
 _octify ($str)
 "Octifies" a binary string by returning a string with escaped octal bytes. More...
 
 _unoctify ($str)
 "Unoctifies" octal-escaped data from PostgreSQL and returns the resulting ASCII (possibly binary) string. More...
 
 cleanupNonces ()
 
 cleanupAssociations ()
 
- Public Member Functions inherited from Auth_OpenID_OpenIDStore
 storeAssociation ($server_url, $association)
 This method puts an Association object into storage, retrievable by server URL and handle. More...
 
 cleanupNonces ()
 
 cleanupAssociations ()
 
 cleanup ()
 
 supportsCleanup ()
 Report whether this storage supports cleanup. More...
 
 getAssociation ($server_url, $handle=null)
 This method returns an Association object from storage that matches the server URL and, if specified, handle. More...
 
 removeAssociation ($server_url, $handle)
 This method removes the matching association if it's found, and returns whether the association was removed or not. More...
 
 useNonce ($server_url, $timestamp, $salt)
 Called when using a nonce. More...
 
 reset ()
 Removes all entries from the store; implementation is optional. More...
 

Detailed Description

Definition at line 19 of file PostgreSQLStore.php.

Member Function Documentation

◆ _set_assoc()

Auth_OpenID_PostgreSQLStore::_set_assoc (   $server_url,
  $handle,
  $secret,
  $issued,
  $lifetime,
  $assoc_type 
)

private

Definition at line 78 of file PostgreSQLStore.php.

References $result, and Auth_OpenID_SQLStore\_get_assoc().

80  {
81  $result = $this->_get_assoc($server_url, $handle);
82  if ($result) {
83  // Update the table since this associations already exists.
84  $this->connection->query($this->sql['set_assoc']['update_assoc'],
85  array($secret, $issued, $lifetime,
86  $assoc_type, $server_url, $handle));
87  } else {
88  // Insert a new record because this association wasn't
89  // found.
90  $this->connection->query($this->sql['set_assoc']['insert_assoc'],
91  array($server_url, $handle, $secret,
92  $issued, $lifetime, $assoc_type));
93  }
94  }
$result
_get_assoc($server_url, $handle)
private
Definition: SQLStore.php:354
+ Here is the call graph for this function:

◆ blobDecode()

Auth_OpenID_PostgreSQLStore::blobDecode (   $blob)

private

Definition at line 107 of file PostgreSQLStore.php.

References Auth_OpenID_SQLStore\_unoctify().

108  {
109  return $this->_unoctify($blob);
110  }
_unoctify($str)
"Unoctifies" octal-escaped data from PostgreSQL and returns the resulting ASCII (possibly binary) str...
Definition: SQLStore.php:508
+ Here is the call graph for this function:

◆ blobEncode()

Auth_OpenID_PostgreSQLStore::blobEncode (   $blob)

private

Definition at line 99 of file PostgreSQLStore.php.

References Auth_OpenID_SQLStore\_octify().

100  {
101  return $this->_octify($blob);
102  }
_octify($str)
"Octifies" a binary string by returning a string with escaped octal bytes.
Definition: SQLStore.php:486
+ Here is the call graph for this function:

◆ setSQL()

Auth_OpenID_PostgreSQLStore::setSQL ( )

private

Definition at line 23 of file PostgreSQLStore.php.

24  {
25  $this->sql['nonce_table'] =
26  "CREATE TABLE %s (server_url VARCHAR(2047) NOT NULL, ".
27  "timestamp INTEGER NOT NULL, ".
28  "salt CHAR(40) NOT NULL, ".
29  "UNIQUE (server_url, timestamp, salt))";
30 
31  $this->sql['assoc_table'] =
32  "CREATE TABLE %s (server_url VARCHAR(2047) NOT NULL, ".
33  "handle VARCHAR(255) NOT NULL, ".
34  "secret BYTEA NOT NULL, ".
35  "issued INTEGER NOT NULL, ".
36  "lifetime INTEGER NOT NULL, ".
37  "assoc_type VARCHAR(64) NOT NULL, ".
38  "PRIMARY KEY (server_url, handle), ".
39  "CONSTRAINT secret_length_constraint CHECK ".
40  "(LENGTH(secret) <= 128))";
41 
42  $this->sql['set_assoc'] =
43  array(
44  'insert_assoc' => "INSERT INTO %s (server_url, handle, ".
45  "secret, issued, lifetime, assoc_type) VALUES ".
46  "(?, ?, '!', ?, ?, ?)",
47  'update_assoc' => "UPDATE %s SET secret = '!', issued = ?, ".
48  "lifetime = ?, assoc_type = ? WHERE server_url = ? AND ".
49  "handle = ?"
50  );
51 
52  $this->sql['get_assocs'] =
53  "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
54  "WHERE server_url = ?";
55 
56  $this->sql['get_assoc'] =
57  "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
58  "WHERE server_url = ? AND handle = ?";
59 
60  $this->sql['remove_assoc'] =
61  "DELETE FROM %s WHERE server_url = ? AND handle = ?";
62 
63  $this->sql['add_nonce'] =
64  "INSERT INTO %s (server_url, timestamp, salt) VALUES ".
65  "(?, ?, ?)"
66  ;
67 
68  $this->sql['clean_nonce'] =
69  "DELETE FROM %s WHERE timestamp < ?";
70 
71  $this->sql['clean_assoc'] =
72  "DELETE FROM %s WHERE issued + lifetime < ?";
73  }

The documentation for this class was generated from the following file: