ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
Auth_OpenID_SRegRequest Class Reference
+ Inheritance diagram for Auth_OpenID_SRegRequest:
+ Collaboration diagram for Auth_OpenID_SRegRequest:

Public Member Functions

 parseExtensionArgs ($args, $strict=false)
 Parse the unqualified simple registration request parameters and add them to this object.
 allRequestedFields ()
 A list of all of the simple registration fields that were requested, whether they were required or optional.
 wereFieldsRequested ()
 Have any simple registration fields been requested?
 contains ($field_name)
 Was this field in the request?
 requestField ($field_name, $required=false, $strict=false)
 Request the specified field from the OpenID user.
 requestFields ($field_names, $required=false, $strict=false)
 Add the given list of fields to the request.
 getExtensionArgs ()
 Get a dictionary of unqualified simple registration arguments representing this request.

Static Public Member Functions

static build ($required=null, $optional=null, $policy_url=null, $sreg_ns_uri=Auth_OpenID_SREG_NS_URI, $cls='Auth_OpenID_SRegRequest')
 Initialize an empty simple registration request.
static fromOpenIDRequest ($request, $cls='Auth_OpenID_SRegRequest')
 Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments.
- Static Public Member Functions inherited from Auth_OpenID_SRegBase
static _getSRegNS ($message)
 Extract the simple registration namespace URI from the given OpenID message.

Data Fields

 $ns_alias = 'sreg'

Detailed Description

Definition at line 169 of file SReg.php.

Member Function Documentation

Auth_OpenID_SRegRequest::allRequestedFields ( )

A list of all of the simple registration fields that were requested, whether they were required or optional.

Definition at line 287 of file SReg.php.

Referenced by wereFieldsRequested().

{
return array_merge($this->required, $this->optional);
}

+ Here is the caller graph for this function:

static Auth_OpenID_SRegRequest::build (   $required = null,
  $optional = null,
  $policy_url = null,
  $sreg_ns_uri = Auth_OpenID_SREG_NS_URI,
  $cls = 'Auth_OpenID_SRegRequest' 
)
static

Initialize an empty simple registration request.

Definition at line 176 of file SReg.php.

Referenced by ilAuthOpenId\callProvider().

{
$obj = new $cls();
$obj->required = array();
$obj->optional = array();
$obj->policy_url = $policy_url;
$obj->ns_uri = $sreg_ns_uri;
if ($required) {
if (!$obj->requestFields($required, true, true)) {
return null;
}
}
if ($optional) {
if (!$obj->requestFields($optional, false, true)) {
return null;
}
}
return $obj;
}

+ Here is the caller graph for this function:

Auth_OpenID_SRegRequest::contains (   $field_name)

Was this field in the request?

Definition at line 303 of file SReg.php.

Referenced by requestField().

{
return (in_array($field_name, $this->required) ||
in_array($field_name, $this->optional));
}

+ Here is the caller graph for this function:

static Auth_OpenID_SRegRequest::fromOpenIDRequest (   $request,
  $cls = 'Auth_OpenID_SRegRequest' 
)
static

Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments.

$request: The OpenID authentication request from which to extract an sreg request.

$cls: name of class to use when creating sreg request object. Used for testing.

Returns the newly created simple registration request

Definition at line 216 of file SReg.php.

References Auth_OpenID_SREG_NS_URI, and Auth_OpenID\isFailure().

{
$obj = call_user_func_array(array($cls, 'build'),
array(null, null, null, Auth_OpenID_SREG_NS_URI, $cls));
// Since we're going to mess with namespace URI mapping, don't
// mutate the object that was passed in.
$m = $request->message;
$obj->ns_uri = $obj->_getSRegNS($m);
$args = $m->getArgs($obj->ns_uri);
if ($args === null || Auth_OpenID::isFailure($args)) {
return null;
}
$obj->parseExtensionArgs($args);
return $obj;
}

+ Here is the call graph for this function:

Auth_OpenID_SRegRequest::getExtensionArgs ( )

Get a dictionary of unqualified simple registration arguments representing this request.

This method is essentially the inverse of C{L{parseExtensionArgs}}. This method serializes the simple registration request fields.

Reimplemented from Auth_OpenID_Extension.

Definition at line 389 of file SReg.php.

{
$args = array();
if ($this->required) {
$args['required'] = implode(',', $this->required);
}
if ($this->optional) {
$args['optional'] = implode(',', $this->optional);
}
if ($this->policy_url) {
$args['policy_url'] = $this->policy_url;
}
return $args;
}
Auth_OpenID_SRegRequest::parseExtensionArgs (   $args,
  $strict = false 
)

Parse the unqualified simple registration request parameters and add them to this object.

This method is essentially the inverse of getExtensionArgs. This method restores the serialized simple registration request fields.

If you are extracting arguments from a standard OpenID checkid_* request, you probably want to use fromOpenIDRequest, which will extract the sreg namespace and arguments from the OpenID request. This method is intended for cases where the OpenID server needs more control over how the arguments are parsed than that method provides.

$args == $message->getArgs($ns_uri); $request->parseExtensionArgs($args);

$args: The unqualified simple registration arguments

strict: Whether requests with fields that are not defined in the simple registration specification should be tolerated (and ignored)

Definition at line 262 of file SReg.php.

References Auth_OpenID\arrayGet(), and requestField().

{
foreach (array('required', 'optional') as $list_name) {
$required = ($list_name == 'required');
$items = Auth_OpenID::arrayGet($args, $list_name);
if ($items) {
foreach (explode(',', $items) as $field_name) {
if (!$this->requestField($field_name, $required, $strict)) {
if ($strict) {
return false;
}
}
}
}
}
$this->policy_url = Auth_OpenID::arrayGet($args, 'policy_url');
return true;
}

+ Here is the call graph for this function:

Auth_OpenID_SRegRequest::requestField (   $field_name,
  $required = false,
  $strict = false 
)

Request the specified field from the OpenID user.

$field_name: the unqualified simple registration field name

required: whether the given field should be presented to the user as being a required to successfully complete the request

strict: whether to raise an exception when a field is added to a request more than once

Definition at line 320 of file SReg.php.

References Auth_OpenID_checkFieldName(), and contains().

Referenced by parseExtensionArgs(), and requestFields().

{
if (!Auth_OpenID_checkFieldName($field_name)) {
return false;
}
if ($strict) {
if ($this->contains($field_name)) {
return false;
}
} else {
if (in_array($field_name, $this->required)) {
return true;
}
if (in_array($field_name, $this->optional)) {
if ($required) {
unset($this->optional[array_search($field_name,
$this->optional)]);
} else {
return true;
}
}
}
if ($required) {
$this->required[] = $field_name;
} else {
$this->optional[] = $field_name;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Auth_OpenID_SRegRequest::requestFields (   $field_names,
  $required = false,
  $strict = false 
)

Add the given list of fields to the request.

field_names: The simple registration data fields to request

required: Whether these values should be presented to the user as required

strict: whether to raise an exception when a field is added to a request more than once

Definition at line 366 of file SReg.php.

References requestField().

{
if (!is_array($field_names)) {
return false;
}
foreach ($field_names as $field_name) {
if (!$this->requestField($field_name, $required, $strict=$strict)) {
return false;
}
}
return true;
}

+ Here is the call graph for this function:

Auth_OpenID_SRegRequest::wereFieldsRequested ( )

Have any simple registration fields been requested?

Definition at line 295 of file SReg.php.

References allRequestedFields().

{
return count($this->allRequestedFields());
}

+ Here is the call graph for this function:

Field Documentation

Auth_OpenID_SRegRequest::$ns_alias = 'sreg'

Definition at line 171 of file SReg.php.


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