Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $path_extra = dirname(dirname(dirname(__FILE__)));
- $path = ini_get('include_path');
- $path = $path_extra . PATH_SEPARATOR . $path;
- ini_set('include_path', $path);
- function displayError($message) {
- $error = $message;
- include 'index.php';
- exit(0);
- }
- function doIncludes() {
- // Require the OpenID consumer code.
- require_once "Auth/OpenID/Consumer.php";
- // Require the "file store" module, which we'll need to store
- // OpenID information.
- require_once "Auth/OpenID/FileStore.php";
- // Require the Attribute Exchange extension API.
- require_once "Auth/OpenID/AX.php";
- // Require the PAPE extension module.
- require_once "Auth/OpenID/PAPE.php";
- }
- doIncludes();
- global $pape_policy_uris;
- $pape_policy_uris = array(
- PAPE_AUTH_MULTI_FACTOR_PHYSICAL,
- PAPE_AUTH_MULTI_FACTOR,
- PAPE_AUTH_PHISHING_RESISTANT
- );
- function &getStore() {
- #store data here
- $store_path = "/tmp/_php_consumer_test";
- if (!file_exists($store_path) &&
- !mkdir($store_path)) {
- print "Could not create the FileStore directory '$store_path'. ".
- " Please check the effective permissions.";
- exit(0);
- }
- return new Auth_OpenID_FileStore($store_path);
- }
- function getScheme() {
- $scheme = 'http';
- if (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
- $scheme .= 's';
- }
- return $scheme;
- }
- function getReturnTo() {
- if ($_SERVER['SERVER_PORT'] == 80) {
- return sprintf("%s://%s%s/finish_auth.php",
- getScheme(), $_SERVER['SERVER_NAME'],
- dirname($_SERVER['PHP_SELF']));
- } else {
- return sprintf("%s://%s:%s%s/finish_auth.php",
- getScheme(), $_SERVER['SERVER_NAME'],
- $_SERVER['SERVER_PORT'],
- dirname($_SERVER['PHP_SELF']));
- }
- }
- function getTrustRoot() {
- if ($_SERVER['SERVER_PORT'] == 80) {
- return sprintf("%s://%s%s/",
- getScheme(), $_SERVER['SERVER_NAME'],
- dirname($_SERVER['PHP_SELF']));
- } else {
- return sprintf("%s://%s:%s%s/",
- getScheme(), $_SERVER['SERVER_NAME'],
- $_SERVER['SERVER_PORT'],
- dirname($_SERVER['PHP_SELF']));
- }
- }
- function &getConsumer() {
- /**
- * Create a consumer object using the store object created
- * earlier.
- */
- $store = getStore();
- $consumer =& new Auth_OpenID_Consumer($store);
- return $consumer;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement