From f9f91a08b47c0a086c43966b1ecdf87185ceef83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Florian=20H=C3=BClsmann?= Date: Sat, 31 Mar 2012 02:42:41 +0200 Subject: [PATCH] webfinger reimplementation started --- apps/remoteStorage/appinfo/info.xml | 2 +- apps/remoteStorage/appinfo/webfinger.php | 6 +++ apps/user_webfinger/.htaccess | 3 -- apps/user_webfinger/appinfo/info.xml | 6 +-- apps/user_webfinger/host-meta | 1 - apps/user_webfinger/host-meta.php | 16 ------- apps/user_webfinger/webfinger.php | 57 +++++++++++++++++------- 7 files changed, 52 insertions(+), 39 deletions(-) create mode 100644 apps/remoteStorage/appinfo/webfinger.php delete mode 100644 apps/user_webfinger/.htaccess delete mode 100644 apps/user_webfinger/host-meta delete mode 100644 apps/user_webfinger/host-meta.php diff --git a/apps/remoteStorage/appinfo/info.xml b/apps/remoteStorage/appinfo/info.xml index 121587795db..1ab55e8c094 100644 --- a/apps/remoteStorage/appinfo/info.xml +++ b/apps/remoteStorage/appinfo/info.xml @@ -3,7 +3,7 @@ remoteStorage remoteStorage compatibility Enables your users to use ownCloud as their remote storage for unhosted applications. - 0.5 + 0.6 AGPL or MIT Michiel de Jong 2 diff --git a/apps/remoteStorage/appinfo/webfinger.php b/apps/remoteStorage/appinfo/webfinger.php new file mode 100644 index 00000000000..bb3fe1681b3 --- /dev/null +++ b/apps/remoteStorage/appinfo/webfinger.php @@ -0,0 +1,6 @@ + + diff --git a/apps/user_webfinger/.htaccess b/apps/user_webfinger/.htaccess deleted file mode 100644 index 4d4d2e9c58f..00000000000 --- a/apps/user_webfinger/.htaccess +++ /dev/null @@ -1,3 +0,0 @@ -RewriteEngine On -RewriteBase / -RewriteRule host-meta$ \/\.well-known\/host-meta\.php [L] diff --git a/apps/user_webfinger/appinfo/info.xml b/apps/user_webfinger/appinfo/info.xml index 55cf2cf2201..d47fb723a3a 100644 --- a/apps/user_webfinger/appinfo/info.xml +++ b/apps/user_webfinger/appinfo/info.xml @@ -2,9 +2,9 @@ user_webfinger Webfinger - Provide WebFinger for all users so they get a user address like user@owncloudinstance which can be used for unhosted applications. If you don't run ownCloud in the root of your domain, for instance if you run it on example.com/owncloud/, then make sure you link example.com/.well-known/ to example.com/owncloud/apps/user_webfinger/ - by running something like "ln -s /var/www/owncloud/apps/user_webfinger /var/www/.well-known". Only enable this app if you run this ownCloud installation on a public web address, not if you run it on an intranet or on localhost. - 0.2 + Provide WebFinger for all users so they get a user address like user@owncloudinstance which can be used for external applications. Other apps can provide information for webfinger requests, such as remoteStorage compatibility. + 0.3 AGPL or MIT - Michiel de Jong + Michiel de Jong, Florian Hülsmann 2 diff --git a/apps/user_webfinger/host-meta b/apps/user_webfinger/host-meta deleted file mode 100644 index dfaf3636145..00000000000 --- a/apps/user_webfinger/host-meta +++ /dev/null @@ -1 +0,0 @@ -please run 'a2enmod rewrite' on your server, set 'AllowOverride All' for /var/www in /etc/apache2/sites-enabled/000-default or equivalent, and then run '/etc/init.d/apache2 restart' diff --git a/apps/user_webfinger/host-meta.php b/apps/user_webfinger/host-meta.php deleted file mode 100644 index ac577cf9a0c..00000000000 --- a/apps/user_webfinger/host-meta.php +++ /dev/null @@ -1,16 +0,0 @@ - -?xml version="1.0" encoding="UTF-8"?> - - - - - - diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php index 5c2a24aa070..ecbfeed8e4b 100644 --- a/apps/user_webfinger/webfinger.php +++ b/apps/user_webfinger/webfinger.php @@ -1,41 +1,68 @@ /apps/myApp/profile.php?user="> + * + * + '* but can also use complex database queries to generate the webfinger result + **/ // calculate the documentroot // modified version of the one in lib/base.php that takes the .well-known symlink into account -$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); +/*$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); $SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__))))); $SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); $WEBROOT=substr($SUBURI,0,-34); +*/ +require_once('../../lib/base.php'); +$id = $_GET['q']; if($_GET['q']) { $bits = explode('@', $_GET['q']); $userName = $bits[0]; } else { + $id = ''; $userName = ''; } if(substr($userName, 0, 5) == 'acct:') { $userName = substr($userName, 5); } if(isset($_SERVER['HTTPS'])) { - $baseAddress = 'https://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/'; + $baseAddress = 'https://'; } else { - $baseAddress = 'http://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/'; + $baseAddress = 'http://'; } +$baseAddress .= $_SERVER['SERVER_NAME'].OC::$WEBROOT; +define('WF_USER', $userName); +define('WF_ADDRESS', $id); +define('WF_ROOT', $baseAddress); echo "<"; ?> ?xml version="1.0" encoding="UTF-8"?> - - + + acct: + -- 2.39.5