24 function set($name, $value)
38 function get($name, $default=
null)
103 $required = $this->requiredKeys();
105 foreach ($required as $k) {
106 if (!array_key_exists($k,
$data)) {
122 foreach ($required as $k) {
123 $obj->$k =
$data[$k];
165 foreach ($obj as $k => $v) {
171 if ($extra && is_array($extra)) {
172 foreach ($extra as $k => $v) {
206 foreach ($obj as $k => $v) {
214 return is_array(
$data[
'type_uris']);
226 return array(
'starting_url',
239 $data[
'session_key']);
244 return is_array(
$data[
'services']);
251 foreach (
$data[
'services'] as $s) {
252 $services[] =
$loader->fromSession($s);
254 return array(
'services' => $services);
261 foreach ($obj->services as $s) {
262 $services[] =
$loader->toSession($s);
264 return array(
'services' => $services);
284 $services, $session_key)
287 $this->starting_url = $starting_url;
290 $this->yadis_url = $yadis_url;
293 $this->services = $services;
295 $this->session_key = $session_key;
298 $this->_current =
null;
301 $this->stale =
false;
310 return count($this->services);
322 if ($this->services) {
323 $this->_current = array_shift($this->services);
325 $this->_current =
null;
328 return $this->_current;
338 return $this->_current;
346 return in_array(
$url, array($this->starting_url, $this->yadis_url));
355 return $this->_current !==
null;
391 $session_key_suffix =
null)
394 $this->session = $session;
396 if ($session_key_suffix ===
null) {
400 $this->session_key_suffix = $session_key_suffix;
401 $this->session_key = $this->PREFIX . $this->session_key_suffix;
411 if (!$manager || (!$manager->services)) {
414 list($yadis_url, $services) = call_user_func($discover_cb,
423 $service = $manager->nextService();
424 $this->session->set($this->session_key,
425 serialize(
$loader->toSession($manager)));
445 $service = $manager->current();
460 return $this->PREFIX . $this->session_key_suffix;
477 if ($manager_str !==
null) {
479 $manager =
$loader->fromSession(unserialize($manager_str));
482 if ($manager && ($manager->forURL($this->url) || $force)) {
501 $this->session->set($this->session_key,
502 serialize(
$loader->toSession($manager)));
517 $this->session->del($key);
newObject($data)
Returns a new instance of this loader's class, using the session data to construct it if necessary.
check($data)
Override this.
Object representing an OpenID service endpoint.
getNextService($discover_cb, $fetcher)
Return the next authentication service for the pair of user_input and session.
cleanup($force=false)
Clean up Yadis-related services in the session and return the most-recently-attempted service from th...
destroyManager($force=false)
@access private
getManager($force=false)
@access private
createManager($services, $yadis_url=null)
@access private
Auth_Yadis_Discovery($session, $url, $session_key_suffix=null)
Initialize a discovery object.
getSessionKey()
@access private
$DEFAULT_SUFFIX
@access private
check($data)
Override this.
prepareForSave($obj)
Override this.
newObject($data)
Returns a new instance of this loader's class, using the session data to construct it if necessary.
prepareForLoad($data)
Prepares the data array by making any necessary changes.
forURL($url)
@access private
Auth_Yadis_Manager($starting_url, $yadis_url, $services, $session_key)
Intialize a new yadis service manager.
nextService()
Return the next service.
contents()
Return the contents of the session in array form.
del($name)
Remove a key/value pair from the session.
fromSession($data)
Given a session data value (an array), this creates an object (returned by $this->newObject()) whose ...
newObject($data)
Returns a new instance of this loader's class, using the session data to construct it if necessary.
toSession($obj)
Returns an array of keys and values built from the attributes of $obj.
prepareForSave($obj)
Override this.
prepareForLoad($data)
Prepares the data array by making any necessary changes.
check($data)
Override this.