ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
Auth_OpenID_AX_FetchRequest Class Reference
+ Inheritance diagram for Auth_OpenID_AX_FetchRequest:
+ Collaboration diagram for Auth_OpenID_AX_FetchRequest:

Public Member Functions

 Auth_OpenID_AX_FetchRequest ($update_url=null)
 add ($attribute)
 Add an attribute to this attribute exchange request.
 getExtensionArgs ()
 Get the serialized form of this attribute fetch request.
 getRequiredAttrs ()
 Get the type URIs for all attributes that have been marked as required.
 parseExtensionArgs ($ax_args)
 Given attribute exchange arguments, populate this FetchRequest.
 iterAttrs ()
 Iterate over the AttrInfo objects that are contained in this fetch_request.
 iterTypes ()
 contains ($type_uri)
 Is the given type URI present in this fetch_request?
- Public Member Functions inherited from Auth_OpenID_AX_Message
 _checkMode ($ax_args)
 Return Auth_OpenID_AX_Error if the mode in the attribute exchange arguments does not match what is expected for this class; true otherwise.
 _newArgs ()
 Return a set of attribute exchange arguments containing the basic information that must be in every attribute exchange message.
- Public Member Functions inherited from Auth_OpenID_Extension
 toMessage ($message)
 Add the arguments from this extension to the provided message.

Static Public Member Functions

static fromOpenIDRequest ($request)
 Extract a FetchRequest from an OpenID message.

Data Fields

 $mode = 'fetch_request'
- Data Fields inherited from Auth_OpenID_AX_Message
 $ns_alias = 'ax'
 ns_alias: The preferred namespace alias for attribute exchange messages
 $mode = null
 mode: The type of this attribute exchange message.
 $ns_uri = Auth_OpenID_AX_NS_URI
- Data Fields inherited from Auth_OpenID_Extension
 $ns_uri = null
 ns_uri: The namespace to which to add the arguments for this extension
 $ns_alias = null

Detailed Description

Definition at line 267 of file AX.php.

Member Function Documentation

Auth_OpenID_AX_FetchRequest::add (   $attribute)

Add an attribute to this attribute exchange request.

Parameters
attribute,:The attribute that is being requested
Returns
true on success, false when the requested attribute is already present in this fetch request.

Definition at line 294 of file AX.php.

{
if ($this->contains($attribute->type_uri)) {
sprintf("The attribute %s has already been requested",
$attribute->type_uri));
}
$this->requested_attributes[$attribute->type_uri] = $attribute;
return true;
Auth_OpenID_AX_FetchRequest::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.

Definition at line 271 of file AX.php.

{
$this->requested_attributes = array();
$this->update_url = $update_url;
Auth_OpenID_AX_FetchRequest::contains (   $type_uri)

Is the given type URI present in this fetch_request?

Definition at line 527 of file AX.php.

{
return in_array($type_uri, $this->iterTypes());
static Auth_OpenID_AX_FetchRequest::fromOpenIDRequest (   $request)
static

Extract a FetchRequest from an OpenID message.

Parameters
request,:The OpenID request containing the attribute fetch request
Returns
mixed An Auth_OpenID_AX_Error or the Auth_OpenID_AX_FetchRequest extracted from the request message if successful

Definition at line 388 of file AX.php.

{
$m = $request->message;
$ax_args = $m->getArgs($obj->ns_uri);
$result = $obj->parseExtensionArgs($ax_args);
return $result;
}
if ($obj->update_url) {
// Update URL must match the openid.realm of the
// underlying OpenID 2 message.
$realm = $m->getArg(Auth_OpenID_OPENID_NS, 'realm',
$m->getArg(
'return_to'));
if (!$realm) {
sprintf("Cannot validate update_url %s " .
"against absent realm", $obj->update_url));
} else if (!Auth_OpenID_TrustRoot::match($realm,
$obj->update_url)) {
sprintf("Update URL %s failed validation against realm %s",
$obj->update_url, $realm));
}
}
return $obj;
Auth_OpenID_AX_FetchRequest::getExtensionArgs ( )

Get the serialized form of this attribute fetch request.

Returns
Auth_OpenID_AX_FetchRequest The fetch request message parameters

Reimplemented from Auth_OpenID_Extension.

Definition at line 312 of file AX.php.

{
$aliases = new Auth_OpenID_NamespaceMap();
$required = array();
$if_available = array();
$ax_args = $this->_newArgs();
foreach ($this->requested_attributes as $type_uri => $attribute) {
if ($attribute->alias === null) {
$alias = $aliases->add($type_uri);
} else {
$alias = $aliases->addAlias($type_uri, $attribute->alias);
if ($alias === null) {
sprintf("Could not add alias %s for URI %s",
$attribute->alias, $type_uri
));
}
}
if ($attribute->required) {
$required[] = $alias;
} else {
$if_available[] = $alias;
}
if ($attribute->count != 1) {
$ax_args['count.' . $alias] = strval($attribute->count);
}
$ax_args['type.' . $alias] = $type_uri;
}
if ($required) {
$ax_args['required'] = implode(',', $required);
}
if ($if_available) {
$ax_args['if_available'] = implode(',', $if_available);
}
return $ax_args;
Auth_OpenID_AX_FetchRequest::getRequiredAttrs ( )

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

Returns
A list of the type URIs for attributes that have been marked as required.

Definition at line 366 of file AX.php.

{
$required = array();
foreach ($this->requested_attributes as $type_uri => $attribute) {
if ($attribute->required) {
$required[] = $type_uri;
}
}
return $required;
Auth_OpenID_AX_FetchRequest::iterAttrs ( )

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

Definition at line 514 of file AX.php.

{
return array_values($this->requested_attributes);
Auth_OpenID_AX_FetchRequest::iterTypes ( )

Definition at line 519 of file AX.php.

{
return array_keys($this->requested_attributes);
Auth_OpenID_AX_FetchRequest::parseExtensionArgs (   $ax_args)

Given attribute exchange arguments, populate this FetchRequest.

Returns
$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.

Definition at line 431 of file AX.php.

{
$result = $this->_checkMode($ax_args);
return $result;
}
$aliases = new Auth_OpenID_NamespaceMap();
foreach ($ax_args as $key => $value) {
if (strpos($key, 'type.') === 0) {
$alias = substr($key, 5);
$type_uri = $value;
$alias = $aliases->addAlias($type_uri, $alias);
if ($alias === null) {
sprintf("Could not add alias %s for URI %s",
$alias, $type_uri)
);
}
$count_s = Auth_OpenID::arrayGet($ax_args, 'count.' . $alias);
if ($count_s) {
$count = Auth_OpenID::intval($count_s);
if (($count === false) &&
$count = $count_s;
}
} else {
$count = 1;
}
if ($count === false) {
sprintf("Integer value expected for %s, got %s",
'count.' . $alias, $count_s));
}
$attrinfo = Auth_OpenID_AX_AttrInfo::make($type_uri, $count,
false, $alias);
if (Auth_OpenID_AX::isError($attrinfo)) {
return $attrinfo;
}
$this->add($attrinfo);
}
}
$required = Auth_OpenID_AX_toTypeURIs($aliases,
Auth_OpenID::arrayGet($ax_args, 'required'));
foreach ($required as $type_uri) {
$attrib = $this->requested_attributes[$type_uri];
$attrib->required = true;
}
$if_available = Auth_OpenID_AX_toTypeURIs($aliases,
Auth_OpenID::arrayGet($ax_args, 'if_available'));
$all_type_uris = array_merge($required, $if_available);
foreach ($aliases->iterNamespaceURIs() as $type_uri) {
if (!in_array($type_uri, $all_type_uris)) {
sprintf('Type URI %s was in the request but not ' .
'present in "required" or "if_available"',
$type_uri));
}
}
$this->update_url = Auth_OpenID::arrayGet($ax_args, 'update_url');
return true;

Field Documentation

Auth_OpenID_AX_FetchRequest::$mode = 'fetch_request'

Definition at line 269 of file AX.php.


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