3 * WebFinger resource parent class
6 * @author Mikael Nordfeldth
7 * @copyright 2013 Free Software Foundation, Inc.
8 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
9 * @link http://status.net/
12 abstract class WebFingerResource
14 protected $identities = array();
16 protected $object = null;
17 protected $type = null;
19 public function __construct(Managed_DataObject $object)
21 $this->object = $object;
24 public function getObject()
26 if ($this->object === null) {
27 throw new ServerException('Object is not set');
32 public function getAliases()
34 $aliases = $this->object->getAliases();
36 // Some sites have changed from http to https and still want
37 // (because remote sites look for it) verify that they are still
38 // the same identity as they were on HTTP. Should NOT be used if
39 // you've run HTTPS all the time!
40 if (common_config('webfinger', 'http_alias')) {
41 foreach ($aliases as $alias=>$id) {
42 if (!strtolower(parse_url($alias, PHP_URL_SCHEME)) === 'https') {
45 $aliases[preg_replace('/^https:/', 'http:', $alias, 1)] = $id;
49 // return a unique set of aliases by extracting only the keys
50 return array_keys($aliases);
53 abstract public function updateXRD(XML_XRD $xrd);