* @copyright 2005 Janrain, Inc. * @license http://www.gnu.org/copyleft/lesser.html LGPL */ /** * Data. */ $store_types = array("Filesystem" => "Auth_OpenID_FileStore", "MySQL" => "Auth_OpenID_MySQLStore", "PostgreSQL" => "Auth_OpenID_PostgreSQLStore", "SQLite" => "Auth_OpenID_SQLiteStore"); /** * Main. */ session_start(); init_session(); if (!check_session()) { render_form(); } else { print generate_config(); } /** * Functions. */ function check_session() { if ($_SESSION['store_type'] && $_SESSION['server_url'] && (parse_url($_SESSION['server_url']) !== false) && ((($_SESSION['store_type'] == 'Filesystem') && $_SESSION['store_data']['fs_path']) || (($_SESSION['store_type'] == 'SQLite') && $_SESSION['store_data']['sqlite_path']) || ($_SESSION['store_data']['host'] && $_SESSION['store_data']['username'] && $_SESSION['store_data']['database'] && $_SESSION['store_data']['password']))) { return true; } return false; } function render_form() { global $store_types; global $fields; $basedir_msg = ""; if (ini_get('open_basedir')) { $basedir_msg = "
Note: Due to the ". "open_basedir setting, be sure to ". "choose a path in:"; } ?>

OpenID Server Configuration

This form will auto-generate an OpenID server configuration for use with the OpenID server example.

Store method:
>
>
> >

OpenID Server Configuration

Put this text into a config file called config.php and put it in the server example directory alongside server.php.

/**
 * OpenID server example settings
 *
 * The variables in this file must be customized before you can use
 * the server.
 *
 * @package OpenID.Examples
 * @author JanRain, Inc. 
 * @copyright 2005 Janrain, Inc.
 * @license http://www.gnu.org/copyleft/lesser.html LGPL
 */


/**
 * Set any extra include paths needed to use the library
 */
set_include_path(get_include_path() . PATH_SEPARATOR . "");


/**
 * The URL for the server.
 *
 * This is the location of server.php. For example:
 *
 * $server_url = 'http://example.com/~user/server.php';
 *
 * This must be a full URL.
 */
$server_url = "";

/**
 * Initialize an OpenID store
 *
 * @return object $store an instance of OpenID store (see the
 * documentation for how to create one)
 */
function getOpenIDStore()
{
    require_once 'Auth/OpenID/MySQLStore.php';
    require_once 'DB.php';

    $dsn = array(
                 'phptype'  => 'mysql',
                 'username' => '',
                 'password' => '',
                 'hostspec' => ''
                 );

    $db =& DB::connect($dsn);

    if (PEAR::isError($db)) {
        return null;
    }

    $db->query("USE ");
        
    return new Auth_OpenID_MySQLStore($db);
require_once 'Auth/OpenID/PostgreSQLStore.php';
    require_once 'DB.php';

    $dsn = array(
                 'phptype'  => 'pgsql',
                 'username' => '',
                 'password' => '',
                 'hostspec' => '',
                 'database' => ''
                 );

    $db =& DB::connect($dsn);

    if (PEAR::isError($db)) {
        return null;
    }

    return new Auth_OpenID_PostgreSQLStore($db);

}

/**
 * Users who are allowed to log in to this OpenID server.
 *
 * This is an array from URL to password hash. The URL must include
 * the proper OpenID server information in order to work with this
 * server.
 *
 * This must be set for the server to be usable. If it is not set, no
 * users will be able to log in.
 *
 * Example:
 * $openid_users = array(
 *                    'http://joe.example.com/' => sha1('foo')
 *                      )
 */
$openid_users = array();

/**
 * Trusted sites is an array of trust roots.
 *
 * Sites in this list will not have to be approved by the user in
 * order to be used. It is OK to leave this value as-is.
 *
 * In a more robust server, this site should be a per-user setting.
 */
$trusted_sites = array();