ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Auth_OpenID_AX_FetchResponse Class Reference
+ Inheritance diagram for Auth_OpenID_AX_FetchResponse:
+ Collaboration diagram for Auth_OpenID_AX_FetchResponse:

Public Member Functions

 Auth_OpenID_AX_FetchResponse ($update_url=null)
 
 getExtensionArgs ($request=null)
 Serialize this object into arguments in the attribute exchange namespace. More...
 
 parseExtensionArgs ($ax_args)
 
- Public Member Functions inherited from Auth_OpenID_AX_KeyValueMessage
 Auth_OpenID_AX_KeyValueMessage ()
 
 addValue ($type_uri, $value)
 Add a single value for the given attribute type to the message. More...
 
 setValues ($type_uri, &$values)
 Set the values for the given attribute type. More...
 
 _getExtensionKVArgs ($aliases)
 Get the extension arguments for the key/value pairs contained in this message. More...
 
 parseExtensionArgs ($ax_args)
 Parse attribute exchange key/value arguments into this object. More...
 
 getSingle ($type_uri, $default=null)
 Get a single value for an attribute. More...
 
 get ($type_uri)
 Get the list of values for this attribute in the fetch_response. More...
 
 count ($type_uri)
 Get the number of responses for a particular attribute in this fetch_response message. More...
 
- 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. More...
 
 _newArgs ()
 Return a set of attribute exchange arguments containing the basic information that must be in every attribute exchange message. More...
 
- Public Member Functions inherited from Auth_OpenID_Extension
 getExtensionArgs ()
 Get the string arguments that should be added to an OpenID message for this extension. More...
 
 toMessage ($message)
 Add the arguments from this extension to the provided message. More...
 

Static Public Member Functions

static fromSuccessResponse ($success_response, $signed=true)
 Construct a FetchResponse object from an OpenID library SuccessResponse object. More...
 

Data Fields

 $mode = 'fetch_response'
 
- Data Fields inherited from Auth_OpenID_AX_Message
 $ns_alias = 'ax'
 ns_alias: The preferred namespace alias for attribute exchange messages More...
 
 $mode = null
 mode: The type of this attribute exchange message. More...
 
 $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 More...
 
 $ns_alias = null
 

Detailed Description

Definition at line 792 of file AX.php.

Member Function Documentation

◆ Auth_OpenID_AX_FetchResponse()

Auth_OpenID_AX_FetchResponse::Auth_OpenID_AX_FetchResponse (   $update_url = null)

Definition at line 795 of file AX.php.

797 {
799 $this->update_url = $update_url;

References Auth_OpenID_AX_KeyValueMessage\Auth_OpenID_AX_KeyValueMessage().

+ Here is the call graph for this function:

◆ fromSuccessResponse()

static Auth_OpenID_AX_FetchResponse::fromSuccessResponse (   $success_response,
  $signed = true 
)
static

Construct a FetchResponse object from an OpenID library SuccessResponse object.

Parameters
success_responseA successful id_res response object
signedWhether non-signed args should be processsed. If True (the default), only signed arguments will be processsed.
Returns
$response A FetchResponse containing the data from the OpenID message

Definition at line 924 of file AX.php.

926 {
927 $obj = new Auth_OpenID_AX_FetchResponse();
928 if ($signed) {
929 $ax_args = $success_response->getSignedNS($obj->ns_uri);
930 } else {
931 $ax_args = $success_response->message->getArgs($obj->ns_uri);
932 }
933 if ($ax_args === null || Auth_OpenID::isFailure($ax_args) ||
934 sizeof($ax_args) == 0) {
935 return null;
936 }
937
938 $result = $obj->parseExtensionArgs($ax_args);
940 #XXX log me
941 return null;
942 }
943 return $obj;
$result
Auth_OpenID_AX_FetchResponse($update_url=null)
Definition: AX.php:795
static isError($thing)
Definition: AX.php:40
static isFailure($thing)
Return true if $thing is an Auth_OpenID_FailureResponse object; false if not.
Definition: OpenID.php:118

◆ getExtensionArgs()

Auth_OpenID_AX_FetchResponse::getExtensionArgs (   $request = null)

Serialize this object into arguments in the attribute exchange namespace.

Returns
$args The dictionary of unqualified attribute exchange arguments that represent this fetch_response, or Auth_OpenID_AX_Error on error.

Definition at line 809 of file AX.php.

811 {
812 $aliases = new Auth_OpenID_NamespaceMap();
813
814 $zero_value_types = array();
815
816 if ($request !== null) {
817 // Validate the data in the context of the request (the
818 // same attributes should be present in each, and the
819 // counts in the response must be no more than the counts
820 // in the request)
821
822 foreach ($this->data as $type_uri => $unused) {
823 if (!$request->contains($type_uri)) {
824 return new Auth_OpenID_AX_Error(
825 sprintf("Response attribute not present in request: %s",
826 $type_uri)
827 );
828 }
829 }
830
831 foreach ($request->iterAttrs() as $attr_info) {
832 // Copy the aliases from the request so that reading
833 // the response in light of the request is easier
834 if ($attr_info->alias === null) {
835 $aliases->add($attr_info->type_uri);
836 } else {
837 $alias = $aliases->addAlias($attr_info->type_uri,
838 $attr_info->alias);
839
840 if ($alias === null) {
841 return new Auth_OpenID_AX_Error(
842 sprintf("Could not add alias %s for URI %s",
843 $attr_info->alias, $attr_info->type_uri)
844 );
845 }
846 }
847
848 if (array_key_exists($attr_info->type_uri, $this->data)) {
849 $values = $this->data[$attr_info->type_uri];
850 } else {
851 $values = array();
852 $zero_value_types[] = $attr_info;
853 }
854
855 if (($attr_info->count != Auth_OpenID_AX_UNLIMITED_VALUES) &&
856 ($attr_info->count < count($values))) {
857 return new Auth_OpenID_AX_Error(
858 sprintf("More than the number of requested values " .
859 "were specified for %s",
860 $attr_info->type_uri)
861 );
862 }
863 }
864 }
865
866 $kv_args = $this->_getExtensionKVArgs($aliases);
867
868 // Add the KV args into the response with the args that are
869 // unique to the fetch_response
870 $ax_args = $this->_newArgs();
871
872 // For each requested attribute, put its type/alias and count
873 // into the response even if no data were returned.
874 foreach ($zero_value_types as $attr_info) {
875 $alias = $aliases->getAlias($attr_info->type_uri);
876 $kv_args['type.' . $alias] = $attr_info->type_uri;
877 $kv_args['count.' . $alias] = '0';
878 }
879
880 $update_url = null;
881 if ($request) {
882 $update_url = $request->update_url;
883 } else {
884 $update_url = $this->update_url;
885 }
886
887 if ($update_url) {
888 $ax_args['update_url'] = $update_url;
889 }
890
891 Auth_OpenID::update($ax_args, $kv_args);
892
893 return $ax_args;
const Auth_OpenID_AX_UNLIMITED_VALUES
Definition: AX.php:21
_getExtensionKVArgs($aliases)
Get the extension arguments for the key/value pairs contained in this message.
Definition: AX.php:589
count($type_uri)
Get the number of responses for a particular attribute in this fetch_response message.
Definition: AX.php:774
_newArgs()
Return a set of attribute exchange arguments containing the basic information that must be in every a...
Definition: AX.php:125
static update(&$dest, &$src)
Definition: OpenID.php:511

◆ parseExtensionArgs()

Auth_OpenID_AX_FetchResponse::parseExtensionArgs (   $ax_args)
Returns
$result Auth_OpenID_AX_Error on failure or true on success.

Reimplemented from Auth_OpenID_AX_KeyValueMessage.

Definition at line 899 of file AX.php.

901 {
902 $result = parent::parseExtensionArgs($ax_args);
903
905 return $result;
906 }
907
908 $this->update_url = Auth_OpenID::arrayGet($ax_args, 'update_url');
909
910 return true;
static arrayGet($arr, $key, $fallback=null)
Convenience function for getting array values.
Definition: OpenID.php:242

Field Documentation

◆ $mode

Auth_OpenID_AX_FetchResponse::$mode = 'fetch_response'

Definition at line 793 of file AX.php.


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