Auth_OpenID_Signatory Klassenreferenz


Öffentliche Methoden

 Auth_OpenID_Signatory (&$store)
 verify ($assoc_handle, $message)
 sign ($response)
 createAssociation ($dumb=true, $assoc_type= 'HMAC-SHA1')
 getAssociation ($assoc_handle, $dumb, $check_expiration=true)
 invalidate ($assoc_handle, $dumb)

Datenfelder

 $SECRET_LIFETIME = 1209600
 $normal_key = 'http://localhost/|normal'
 $dumb_key = 'http://localhost/|dumb'

Ausführliche Beschreibung

Definiert in Zeile 1298 der Datei Server.php.


Dokumentation der Elementfunktionen

Auth_OpenID_Signatory ( &$  store  ) 

Create a new signatory using a given store.

Definiert in Zeile 1313 der Datei Server.php.

01314     {
01315         // assert store is not None
01316         $this->store =& $store;
01317     }

createAssociation ( dumb = true,
assoc_type = 'HMAC-SHA1' 
)

Make a new association.

Definiert in Zeile 1372 der Datei Server.php.

01373     {
01374         $secret = Auth_OpenID_CryptUtil::getBytes(
01375                     Auth_OpenID_getSecretSize($assoc_type));
01376 
01377         $uniq = base64_encode(Auth_OpenID_CryptUtil::getBytes(4));
01378         $handle = sprintf('{%s}{%x}{%s}', $assoc_type, intval(time()), $uniq);
01379 
01380         $assoc = Auth_OpenID_Association::fromExpiresIn(
01381                       $this->SECRET_LIFETIME, $handle, $secret, $assoc_type);
01382 
01383         if ($dumb) {
01384             $key = $this->dumb_key;
01385         } else {
01386             $key = $this->normal_key;
01387         }
01388 
01389         $this->store->storeAssociation($key, $assoc);
01390         return $assoc;
01391     }

getAssociation ( assoc_handle,
dumb,
check_expiration = true 
)

Given an association handle, get the association from the store, or return a ServerError or null if something goes wrong.

Definiert in Zeile 1397 der Datei Server.php.

01398     {
01399         if ($assoc_handle === null) {
01400             return new Auth_OpenID_ServerError(null,
01401                                      "assoc_handle must not be null");
01402         }
01403 
01404         if ($dumb) {
01405             $key = $this->dumb_key;
01406         } else {
01407             $key = $this->normal_key;
01408         }
01409 
01410         $assoc = $this->store->getAssociation($key, $assoc_handle);
01411 
01412         if (($assoc !== null) && ($assoc->getExpiresIn() <= 0)) {
01413             if ($check_expiration) {
01414                 $this->store->removeAssociation($key, $assoc_handle);
01415                 $assoc = null;
01416             }
01417         }
01418 
01419         return $assoc;
01420     }

invalidate ( assoc_handle,
dumb 
)

Invalidate a given association handle.

Definiert in Zeile 1425 der Datei Server.php.

01426     {
01427         if ($dumb) {
01428             $key = $this->dumb_key;
01429         } else {
01430             $key = $this->normal_key;
01431         }
01432         $this->store->removeAssociation($key, $assoc_handle);
01433     }

sign ( response  ) 

Given a response, sign the fields in the response's 'signed' list, and insert the signature into the response.

Definiert in Zeile 1339 der Datei Server.php.

01340     {
01341         $signed_response = $response;
01342         $assoc_handle = $response->request->assoc_handle;
01343 
01344         if ($assoc_handle) {
01345             // normal mode
01346             $assoc = $this->getAssociation($assoc_handle, false, false);
01347             if (!$assoc || ($assoc->getExpiresIn() <= 0)) {
01348                 // fall back to dumb mode
01349                 $signed_response->fields->setArg(Auth_OpenID_OPENID_NS,
01350                              'invalidate_handle', $assoc_handle);
01351                 $assoc_type = ($assoc ? $assoc->assoc_type : 'HMAC-SHA1');
01352 
01353                 if ($assoc && ($assoc->getExpiresIn() <= 0)) {
01354                     $this->invalidate($assoc_handle, false);
01355                 }
01356 
01357                 $assoc = $this->createAssociation(true, $assoc_type);
01358             }
01359         } else {
01360             // dumb mode.
01361             $assoc = $this->createAssociation(true);
01362         }
01363 
01364         $signed_response->fields = $assoc->signMessage(
01365                                       $signed_response->fields);
01366         return $signed_response;
01367     }

verify ( assoc_handle,
message 
)

Verify, using a given association handle, a signature with signed key-value pairs from an HTTP request.

Definiert in Zeile 1323 der Datei Server.php.

01324     {
01325         $assoc = $this->getAssociation($assoc_handle, true);
01326         if (!$assoc) {
01327             // oidutil.log("failed to get assoc with handle %r to verify sig %r"
01328             //             % (assoc_handle, sig))
01329             return false;
01330         }
01331 
01332         return $assoc->checkMessageSignature($message);
01333     }


Dokumentation der Datenelemente

$dumb_key = 'http://localhost/|dumb'

Definiert in Zeile 1308 der Datei Server.php.

$normal_key = 'http://localhost/|normal'

Definiert in Zeile 1307 der Datei Server.php.

$SECRET_LIFETIME = 1209600

Definiert in Zeile 1301 der Datei Server.php.


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen