45 require_once
'Auth/OpenID/Message.php';
46 require_once
'Auth/OpenID/Extension.php';
51 'fullname' =>
'Full Name',
52 'nickname' =>
'Nickname',
53 'dob' =>
'Date of Birth',
54 'email' =>
'E-mail Address',
56 'postcode' =>
'Postal Code',
57 'country' =>
'Country',
58 'language' =>
'Language',
59 'timezone' =>
'Time Zone');
69 if (!in_array($field_name, array_keys($Auth_OpenID_sreg_data_fields))) {
77 define(
'Auth_OpenID_SREG_NS_URI_1_0',
'http://openid.net/sreg/1.0');
81 define(
'Auth_OpenID_SREG_NS_URI_1_1',
'http://openid.net/extensions/sreg/1.1');
128 $found_ns_uri = null;
134 $alias = $message->namespaces->getAlias($sreg_ns_uri);
135 if ($alias !== null) {
136 $found_ns_uri = $sreg_ns_uri;
141 if ($alias === null) {
154 return $found_ns_uri;
176 static function build($required=null, $optional=null,
179 $cls=
'Auth_OpenID_SRegRequest')
183 $obj->required = array();
184 $obj->optional = array();
185 $obj->policy_url = $policy_url;
186 $obj->ns_uri = $sreg_ns_uri;
189 if (!$obj->requestFields($required,
true,
true)) {
195 if (!$obj->requestFields($optional,
false,
true)) {
219 $obj = call_user_func_array(array($cls,
'build'),
224 $m = $request->message;
226 $obj->ns_uri = $obj->_getSRegNS($m);
227 $args = $m->getArgs($obj->ns_uri);
233 $obj->parseExtensionArgs($args);
264 foreach (array(
'required',
'optional') as $list_name) {
265 $required = ($list_name ==
'required');
268 foreach (explode(
',', $items) as $field_name) {
269 if (!$this->requestField($field_name, $required, $strict)) {
289 return array_merge($this->required, $this->optional);
297 return count($this->allRequestedFields());
305 return (in_array($field_name, $this->required) ||
306 in_array($field_name, $this->optional));
321 $required=
false, $strict=
false)
328 if ($this->contains($field_name)) {
332 if (in_array($field_name, $this->required)) {
336 if (in_array($field_name, $this->optional)) {
338 unset($this->optional[array_search($field_name,
347 $this->required[] = $field_name;
349 $this->optional[] = $field_name;
368 if (!is_array($field_names)) {
372 foreach ($field_names as $field_name) {
373 if (!$this->requestField($field_name, $required, $strict=$strict)) {
393 if ($this->required) {
394 $args[
'required'] = implode(
',', $this->required);
397 if ($this->optional) {
398 $args[
'optional'] = implode(
',', $this->optional);
401 if ($this->policy_url) {
402 $args[
'policy_url'] = $this->policy_url;
424 if (
$data === null) {
425 $this->data = array();
430 $this->ns_uri = $sreg_ns_uri;
448 $obj->ns_uri = $request->ns_uri;
450 foreach ($request->allRequestedFields() as $field) {
452 if ($value !== null) {
453 $obj->data[$field] = $value;
479 $obj->ns_uri = $obj->_getSRegNS($success_response->message);
482 $args = $success_response->getSignedNS($obj->ns_uri);
484 $args = $success_response->message->getArgs($obj->ns_uri);
491 foreach ($Auth_OpenID_sreg_data_fields as $field_name => $desc) {
492 if (in_array($field_name, array_keys($args))) {
493 $obj->data[$field_name] = $args[$field_name];
506 function get($field_name, $default=null)
getExtensionArgs()
Get a dictionary of unqualified simple registration arguments representing this request.
allRequestedFields()
A list of all of the simple registration fields that were requested, whether they were required or op...
static fromSuccessResponse($success_response, $signed_only=true)
Create a C{L{SRegResponse}} object from a successful OpenID library response (C{L{openid.consumer.consumer.SuccessResponse}}) response message.
static _getSRegNS($message)
Extract the simple registration namespace URI from the given OpenID message.
const Auth_OpenID_SREG_NS_URI_1_1
requestField($field_name, $required=false, $strict=false)
Request the specified field from the OpenID user.
static fromOpenIDRequest($request, $cls='Auth_OpenID_SRegRequest')
Create a simple registration request that contains the fields that were requested in the OpenID reque...
Auth_OpenID_checkFieldName($field_name)
Check to see that the given value is a valid simple registration data field name. ...
static extractResponse($request, $data)
Take a C{L{SRegRequest}} and a dictionary of simple registration values and create a C{L{SRegResponse...
const Auth_OpenID_SREG_NS_URI
Auth_OpenID_SRegResponse($data=null, $sreg_ns_uri=Auth_OpenID_SREG_NS_URI)
global $Auth_OpenID_sreg_data_fields
Import message and extension internals.
const Auth_OpenID_SREG_NS_URI_1_0
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
parseExtensionArgs($args, $strict=false)
Parse the unqualified simple registration request parameters and add them to this object...
static arrayGet($arr, $key, $fallback=null)
Convenience function for getting array values.
Auth_OpenID_registerNamespaceAlias($namespace_uri, $alias)
Registers a (namespace URI, alias) mapping in a global namespace alias map.
wereFieldsRequested()
Have any simple registration fields been requested?
static isFailure($thing)
Return true if $thing is an Auth_OpenID_FailureResponse object; false if not.
contains($field_name)
Was this field in the request?
requestFields($field_names, $required=false, $strict=false)
Add the given list of fields to the request.
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.
Auth_OpenID_supportsSReg($endpoint)
Does the given endpoint advertise support for simple registration?