diff options
| author | Justin J. Novack <jnovack@gmail.com> | 2012-09-16 01:17:46 -0400 |
|---|---|---|
| committer | Justin J. Novack <jnovack@gmail.com> | 2012-09-16 01:17:46 -0400 |
| commit | a73791f16d10ea0e2c477f29d9049d75516aa774 (patch) | |
| tree | c5cc7406b5710804600477a45d20fa21815c67a3 /src | |
| parent | b0687c328fcaa4d891b31c2146694654cd4707c9 (diff) | |
| download | phorkie-a73791f16d10ea0e2c477f29d9049d75516aa774.tar.gz phorkie-a73791f16d10ea0e2c477f29d9049d75516aa774.zip | |
Added OpenID Authentication
Diffstat (limited to 'src')
| -rw-r--r-- | src/openid/config.php | 55 | ||||
| -rw-r--r-- | src/openid/wrapper.php | 27 |
2 files changed, 82 insertions, 0 deletions
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 @@ +<?php +/** + * OpenID + * + * PHP Version 5.2.0+ + * + * @category Auth + * @package OpenID + * @author Bill Shupp <hostmaster@shupp.org> + * @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 @@ +<?php +/** + * OpenID + * + * PHP Version 5.2.0+ + * + * @category Auth + * @package OpenID + * @author Bill Shupp <hostmaster@shupp.org> + * @copyright 2009 Bill Shupp + * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD + * @link http://github.com/shupp/openid + */ +?> +<html> + <head> + <title>PEAR OpenID Debug</title> + <link rel="stylesheet" href="/css/debug.css" type="text/css" /> + </head> + <body> +<?php +if (isset($contents)) { + echo $contents; +} +?> + </body> +</html> |
