Auth_OpenID_AX_FetchRequest Klassenreferenz

Abgeleitet von Auth_OpenID_AX_Message.

Zusammengehörigkeiten von Auth_OpenID_AX_FetchRequest:

Collaboration graph
[Legende]

Öffentliche Methoden

 Auth_OpenID_AX_FetchRequest ($update_url=null)
 add ($attribute)
 getExtensionArgs ()
 getRequiredAttrs ()
fromOpenIDRequest ($request)
 parseExtensionArgs ($ax_args)
 iterAttrs ()
 iterTypes ()
 contains ($type_uri)

Datenfelder

 $mode = 'fetch_request'

Ausführliche Beschreibung

Definiert in Zeile 267 der Datei AX.php.


Dokumentation der Elementfunktionen

add ( attribute  ) 

Add an attribute to this attribute exchange request.

Parameter:
attribute,: The attribute that is being requested
Rückgabe:
true on success, false when the requested attribute is already present in this fetch request.

Definiert in Zeile 294 der Datei AX.php.

00296     {
00297         if ($this->contains($attribute->type_uri)) {
00298             return new Auth_OpenID_AX_Error(
00299               sprintf("The attribute %s has already been requested",
00300                       $attribute->type_uri));
00301         }
00302 
00303         $this->requested_attributes[$attribute->type_uri] = $attribute;
00304 
00305         return true;

Auth_OpenID_AX_FetchRequest ( update_url = null  ) 

requested_attributes: The attributes that have been requested thus far, indexed by the type URI.

update_url: A URL that will accept responses for this attribute exchange request, even in the absence of the user who made this request.

Definiert in Zeile 271 der Datei AX.php.

00273     {
00278         $this->requested_attributes = array();
00279 
00285         $this->update_url = $update_url;

contains ( type_uri  ) 

Is the given type URI present in this fetch_request?

Definiert in Zeile 527 der Datei AX.php.

00529     {
00530         return in_array($type_uri, $this->iterTypes());

& fromOpenIDRequest ( request  ) 

Extract a FetchRequest from an OpenID message

Parameter:
request,: The OpenID request containing the attribute fetch request
Rückgabe:
mixed An Auth_OpenID_AX_Error or the Auth_OpenID_AX_FetchRequest extracted from the request message if successful

Definiert in Zeile 388 der Datei AX.php.

00390     {
00391         $m = $request->message;
00392         $obj = new Auth_OpenID_AX_FetchRequest();
00393         $ax_args = $m->getArgs($obj->ns_uri);
00394 
00395         $result = $obj->parseExtensionArgs($ax_args);
00396 
00397         if (Auth_OpenID_AX::isError($result)) {
00398             return $result;
00399         }
00400 
00401         if ($obj->update_url) {
00402             // Update URL must match the openid.realm of the
00403             // underlying OpenID 2 message.
00404             $realm = $m->getArg(Auth_OpenID_OPENID_NS, 'realm',
00405                         $m->getArg(
00406                                   Auth_OpenID_OPENID_NS,
00407                                   'return_to'));
00408 
00409             if (!$realm) {
00410                 $obj = new Auth_OpenID_AX_Error(
00411                   sprintf("Cannot validate update_url %s " .
00412                           "against absent realm", $obj->update_url));
00413             } else if (!Auth_OpenID_TrustRoot::match($realm,
00414                                                      $obj->update_url)) {
00415                 $obj = new Auth_OpenID_AX_Error(
00416                   sprintf("Update URL %s failed validation against realm %s",
00417                           $obj->update_url, $realm));
00418             }
00419         }
00420 
00421         return $obj;

getExtensionArgs (  ) 

Get the serialized form of this attribute fetch request.

Rückgabe:
Auth_OpenID_AX_FetchRequest The fetch request message parameters

Erneute Implementation von Auth_OpenID_Extension.

Definiert in Zeile 312 der Datei AX.php.

00314     {
00315         $aliases = new Auth_OpenID_NamespaceMap();
00316 
00317         $required = array();
00318         $if_available = array();
00319 
00320         $ax_args = $this->_newArgs();
00321 
00322         foreach ($this->requested_attributes as $type_uri => $attribute) {
00323             if ($attribute->alias === null) {
00324                 $alias = $aliases->add($type_uri);
00325             } else {
00326                 $alias = $aliases->addAlias($type_uri, $attribute->alias);
00327 
00328                 if ($alias === null) {
00329                     return new Auth_OpenID_AX_Error(
00330                       sprintf("Could not add alias %s for URI %s",
00331                               $attribute->alias, $type_uri
00332                       ));
00333                 }
00334             }
00335 
00336             if ($attribute->required) {
00337                 $required[] = $alias;
00338             } else {
00339                 $if_available[] = $alias;
00340             }
00341 
00342             if ($attribute->count != 1) {
00343                 $ax_args['count.' . $alias] = strval($attribute->count);
00344             }
00345 
00346             $ax_args['type.' . $alias] = $type_uri;
00347         }
00348 
00349         if ($required) {
00350             $ax_args['required'] = implode(',', $required);
00351         }
00352 
00353         if ($if_available) {
00354             $ax_args['if_available'] = implode(',', $if_available);
00355         }
00356 
00357         return $ax_args;

getRequiredAttrs (  ) 

Get the type URIs for all attributes that have been marked as required.

Rückgabe:
A list of the type URIs for attributes that have been marked as required.

Definiert in Zeile 366 der Datei AX.php.

00368     {
00369         $required = array();
00370         foreach ($this->requested_attributes as $type_uri => $attribute) {
00371             if ($attribute->required) {
00372                 $required[] = $type_uri;
00373             }
00374         }
00375 
00376         return $required;

iterAttrs (  ) 

Iterate over the AttrInfo objects that are contained in this fetch_request.

Definiert in Zeile 514 der Datei AX.php.

00516     {
00517         return array_values($this->requested_attributes);

iterTypes (  ) 

Definiert in Zeile 519 der Datei AX.php.

00521     {
00522         return array_keys($this->requested_attributes);

parseExtensionArgs ( ax_args  ) 

Given attribute exchange arguments, populate this FetchRequest.

Rückgabe:
$result Auth_OpenID_AX_Error if the data to be parsed does not follow the attribute exchange specification. At least when 'if_available' or 'required' is not specified for a particular attribute type. Returns true otherwise.

Definiert in Zeile 431 der Datei AX.php.

00433     {
00434         $result = $this->_checkMode($ax_args);
00435         if (Auth_OpenID_AX::isError($result)) {
00436             return $result;
00437         }
00438 
00439         $aliases = new Auth_OpenID_NamespaceMap();
00440 
00441         foreach ($ax_args as $key => $value) {
00442             if (strpos($key, 'type.') === 0) {
00443                 $alias = substr($key, 5);
00444                 $type_uri = $value;
00445 
00446                 $alias = $aliases->addAlias($type_uri, $alias);
00447 
00448                 if ($alias === null) {
00449                     return new Auth_OpenID_AX_Error(
00450                       sprintf("Could not add alias %s for URI %s",
00451                               $alias, $type_uri)
00452                       );
00453                 }
00454 
00455                 $count_s = Auth_OpenID::arrayGet($ax_args, 'count.' . $alias);
00456                 if ($count_s) {
00457                     $count = Auth_OpenID::intval($count_s);
00458                     if (($count === false) &&
00459                         ($count_s === Auth_OpenID_AX_UNLIMITED_VALUES)) {
00460                         $count = $count_s;
00461                     }
00462                 } else {
00463                     $count = 1;
00464                 }
00465 
00466                 if ($count === false) {
00467                     return new Auth_OpenID_AX_Error(
00468                       sprintf("Integer value expected for %s, got %s",
00469                               'count.' . $alias, $count_s));
00470                 }
00471 
00472                 $attrinfo = Auth_OpenID_AX_AttrInfo::make($type_uri, $count,
00473                                                           false, $alias);
00474 
00475                 if (Auth_OpenID_AX::isError($attrinfo)) {
00476                     return $attrinfo;
00477                 }
00478 
00479                 $this->add($attrinfo);
00480             }
00481         }
00482 
00483         $required = Auth_OpenID_AX_toTypeURIs($aliases,
00484                          Auth_OpenID::arrayGet($ax_args, 'required'));
00485 
00486         foreach ($required as $type_uri) {
00487             $attrib =& $this->requested_attributes[$type_uri];
00488             $attrib->required = true;
00489         }
00490 
00491         $if_available = Auth_OpenID_AX_toTypeURIs($aliases,
00492                              Auth_OpenID::arrayGet($ax_args, 'if_available'));
00493 
00494         $all_type_uris = array_merge($required, $if_available);
00495 
00496         foreach ($aliases->iterNamespaceURIs() as $type_uri) {
00497             if (!in_array($type_uri, $all_type_uris)) {
00498                 return new Auth_OpenID_AX_Error(
00499                   sprintf('Type URI %s was in the request but not ' .
00500                           'present in "required" or "if_available"',
00501                           $type_uri));
00502 
00503             }
00504         }
00505 
00506         $this->update_url = Auth_OpenID::arrayGet($ax_args, 'update_url');
00507 
00508         return true;


Dokumentation der Datenelemente

$mode = 'fetch_request'

mode: The type of this attribute exchange message. This must be overridden in subclasses.

Erneute Implementation von Auth_OpenID_AX_Message.

Definiert in Zeile 269 der Datei AX.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