From a73791f16d10ea0e2c477f29d9049d75516aa774 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 01:17:46 -0400 Subject: [PATCH] Added OpenID Authentication --- data/config.default.php | 5 + data/config.php.dist | 4 + data/templates/base.htm | 8 + data/templates/forbidden.htm | 21 +++ data/templates/login.htm | 44 ++++++ src/openid/config.php | 55 +++++++ src/openid/wrapper.php | 27 ++++ www/.htaccess | 4 + www/auth.php | 258 ++++++++++++++++++++++++++++++++ www/css/debug.css | 85 +++++++++++ www/css/openid.css | 64 ++++++++ www/delete.php | 3 + www/display.php | 3 + www/edit.php | 3 + www/forbidden.php | 11 ++ www/fork.php | 3 + www/images/access_denied.png | Bin 0 -> 15610 bytes www/images/google.gif | Bin 0 -> 1596 bytes www/images/openid-inputicon.gif | Bin 0 -> 237 bytes www/images/yahoo.gif | Bin 0 -> 1682 bytes www/index.php | 3 + www/list.php | 5 +- www/login.php | 11 ++ www/new.php | 3 + www/raw.php | 3 + www/revision.php | 3 + www/secure.php | 11 ++ www/www-header.php | 4 + 28 files changed, 640 insertions(+), 1 deletion(-) create mode 100644 data/templates/forbidden.htm create mode 100644 data/templates/login.htm create mode 100644 src/openid/config.php create mode 100644 src/openid/wrapper.php create mode 100644 www/auth.php create mode 100644 www/css/debug.css create mode 100644 www/css/openid.css create mode 100644 www/forbidden.php create mode 100644 www/images/access_denied.png create mode 100644 www/images/google.gif create mode 100644 www/images/openid-inputicon.gif create mode 100644 www/images/yahoo.gif create mode 100644 www/login.php create mode 100644 www/secure.php diff --git a/data/config.default.php b/data/config.default.php index 88c9ae5..7ecbda3 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -12,6 +12,11 @@ $GLOBALS['phorkie']['cfg'] = array( 'geshi' => 'MediaWiki/geshi/geshi/geshi.php', 'index' => 'new'//"new" or "list" ); +$GLOBALS['phorkie']['auth'] = array( + 'secure' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = use authentication + 'userlist' => false, // true = user must be explicitly defined, false = anyone allowed, but they must authenticate + 'anonymousEmail' => 'anonymous@phorkie' // Email for non-authenticated commits +); $GLOBALS['phorkie']['tools'] = array( '\\phorkie\\Tool_Xmllint' => true, '\\phorkie\\Tool_PHPlint' => true, diff --git a/data/config.php.dist b/data/config.php.dist index 1e814bd..e90f704 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -5,4 +5,8 @@ //$GLOBALS['phorkie']['cfg']['git']['private'] = 'ssh://git@bogo:paste/'; //$GLOBALS['phorkie']['cfg']['elasticsearch'] = 'http://localhost:9200/phorkie/'; //$GLOBALS['phorkie']['cfg']['setupcheck'] = false; +//$GLOBALS['phorkie']['users'] = array( +// 'https://www.google.com/accounts/o8/id?id=ABCDEFGHIJKLMNOPQRSTUVWXYZ', +// 'http://anonymous.phorkie.openid' +//); ?> diff --git a/data/templates/base.htm b/data/templates/base.htm index 2b8544b..8192b6b 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -25,6 +25,14 @@
  • List all
  • + {% if identity %} +
  • + {{name}} ({{email}}) +
  • +
  • + Logout +
  • + {% endif %} {% if db.adapter %}