From a73791f16d10ea0e2c477f29d9049d75516aa774 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 01:17:46 -0400 Subject: Added OpenID Authentication --- src/openid/config.php | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/openid/wrapper.php | 27 +++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/openid/config.php create mode 100644 src/openid/wrapper.php (limited to 'src') diff --git a/src/openid/config.php b/src/openid/config.php new file mode 100644 index 0000000..fdec5e1 --- /dev/null +++ b/src/openid/config.php @@ -0,0 +1,55 @@ + + * @copyright 2009 Bill Shupp + * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD + * @link http://github.com/shupp/openid + */ + +set_include_path(dirname(__FILE__) . '/../../:' . get_include_path()); + +/** + * Required files + */ +require_once 'OpenID/RelyingParty.php'; +require_once 'OpenID/Discover.php'; +require_once 'OpenID/Store.php'; +require_once 'OpenID/Extension/SREG10.php'; +require_once 'OpenID/Extension/SREG11.php'; +require_once 'OpenID/Extension/AX.php'; +require_once 'OpenID/Extension/UI.php'; +require_once 'OpenID/Extension/OAuth.php'; +require_once 'OpenID/Message.php'; +require_once 'OpenID/Observer/Log.php'; +require_once 'Net/URL2.php'; + +// Determine realm and return_to +$base = 'http'; +if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { + $base .= 's'; +} +$base .= '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']; + +$realm = $base . '/'; +$returnTo = $base . dirname($_SERVER['PHP_SELF']); +if ($returnTo[strlen($returnTo) - 1] != '/') { + $returnTo .= '/'; +} +$returnTo .= 'auth'; + +// SQL storage example +// $storeOptions = array( +// 'dsn' => 'mysql://user:pass@db.example.com/openid' +// ); +// OpenID::setStore(OpenID_Store::factory('MDB2', $storeOptions)); +// +// // The first time you run it, you'll also need to create the tables: +// OpenID::getStore()->createTables(); + +?> diff --git a/src/openid/wrapper.php b/src/openid/wrapper.php new file mode 100644 index 0000000..cb57f4e --- /dev/null +++ b/src/openid/wrapper.php @@ -0,0 +1,27 @@ + + * @copyright 2009 Bill Shupp + * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD + * @link http://github.com/shupp/openid + */ +?> + + + PEAR OpenID Debug + + + + + + -- cgit v1.2.3