summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2006-01-16 23:36:45 +0000
committertailor <cygnus@janrain.com>2006-01-16 23:36:45 +0000
commit1af777dfcba59bd1d768432655d6d8d210e899da (patch)
tree2daa5390620bc9ede3e22e81ed7f123660c3df45
parent8ee5a5830f2cd3d9f9a15df133d8aebbbc74a562 (diff)
downloadphp-openid-1af777dfcba59bd1d768432655d6d8d210e899da.zip
php-openid-1af777dfcba59bd1d768432655d6d8d210e899da.tar.gz
php-openid-1af777dfcba59bd1d768432655d6d8d210e899da.tar.bz2
[project @ Moved modules from Net::OpenID namespace to Auth::OpenID for better PEAR categorization]
-rw-r--r--Auth/OpenID/Association.php (renamed from Net/OpenID/Association.php)28
-rw-r--r--Auth/OpenID/Consumer/Consumer.php (renamed from Net/OpenID/Consumer/Consumer.php)281
-rw-r--r--Auth/OpenID/Consumer/Fetchers.php (renamed from Net/OpenID/Consumer/Fetchers.php)88
-rw-r--r--Auth/OpenID/Consumer/Parse.php (renamed from Net/OpenID/Consumer/Parse.php)94
-rw-r--r--Auth/OpenID/CryptUtil.php (renamed from Net/OpenID/CryptUtil.php)150
-rw-r--r--Auth/OpenID/DiffieHellman.php (renamed from Net/OpenID/DiffieHellman.php)38
-rw-r--r--Auth/OpenID/HMACSHA1.php (renamed from Net/OpenID/HMACSHA1.php)10
-rw-r--r--Auth/OpenID/KVForm.php (renamed from Net/OpenID/KVForm.php)4
-rw-r--r--Auth/OpenID/OIDUtil.php (renamed from Net/OpenID/OIDUtil.php)32
-rw-r--r--Auth/OpenID/Store/DumbStore.php (renamed from Net/OpenID/Store/DumbStore.php)12
-rw-r--r--Auth/OpenID/Store/FileStore.php (renamed from Net/OpenID/Store/FileStore.php)47
-rw-r--r--Auth/OpenID/Store/Interface.php (renamed from Net/OpenID/Store/Interface.php)16
-rw-r--r--Auth/OpenID/Store/SQLStore.php (renamed from Net/OpenID/Store/SQLStore.php)0
-rw-r--r--Tests/Auth/OpenID/Association.php (renamed from Tests/Net/OpenID/Association.php)13
-rw-r--r--Tests/Auth/OpenID/Consumer.php (renamed from Tests/Net/OpenID/Consumer.php)130
-rw-r--r--Tests/Auth/OpenID/CryptUtil.php (renamed from Tests/Net/OpenID/CryptUtil.php)92
-rw-r--r--Tests/Auth/OpenID/DiffieHellman.php (renamed from Tests/Net/OpenID/DiffieHellman.php)46
-rw-r--r--Tests/Auth/OpenID/HMACSHA1.php (renamed from Tests/Net/OpenID/HMACSHA1.php)20
-rw-r--r--Tests/Auth/OpenID/KVForm.php (renamed from Tests/Net/OpenID/KVForm.php)54
-rw-r--r--Tests/Auth/OpenID/OIDUtil.php (renamed from Tests/Net/OpenID/OIDUtil.php)43
-rw-r--r--Tests/Auth/OpenID/Parse.php (renamed from Tests/Net/OpenID/Parse.php)16
-rw-r--r--Tests/Auth/OpenID/StoreTest.php (renamed from Tests/Net/OpenID/StoreTest.php)38
-rw-r--r--Tests/Auth/OpenID/dhexch (renamed from Tests/Net/OpenID/dhexch)0
-rw-r--r--Tests/Auth/OpenID/dhpriv (renamed from Tests/Net/OpenID/dhpriv)0
-rw-r--r--Tests/Auth/OpenID/hmac.txt (renamed from Tests/Net/OpenID/hmac.txt)0
-rw-r--r--Tests/Auth/OpenID/linkparse.txt (renamed from Tests/Net/OpenID/linkparse.txt)0
-rw-r--r--Tests/TestDriver.php22
-rw-r--r--admin/docblocks2
-rw-r--r--admin/makedoc.sh2
-rw-r--r--admin/mathlib4
-rw-r--r--admin/nobadbraces2
-rw-r--r--admin/nobadcase6
-rw-r--r--admin/nolonglines2
-rw-r--r--admin/open_tag2
-rw-r--r--admin/texttest.php2
-rw-r--r--examples/consumer.php34
36 files changed, 667 insertions, 663 deletions
diff --git a/Net/OpenID/Association.php b/Auth/OpenID/Association.php
index 158f617..638e835 100644
--- a/Net/OpenID/Association.php
+++ b/Auth/OpenID/Association.php
@@ -25,7 +25,7 @@ require_once('OIDUtil.php');
* This class represents an association between a server and a
* consumer. In general, users of this library will never see
* instances of this object. The only exception is if you implement a
- * custom Net_OpenID_OpenIDStore.
+ * custom Auth_OpenID_OpenIDStore.
*
* If you do implement such a store, it will need to store the values
* of the handle, secret, issued, lifetime, and assoc_type instance
@@ -33,7 +33,7 @@ require_once('OIDUtil.php');
*
* @package OpenID
*/
-class Net_OpenID_Association {
+class Auth_OpenID_Association {
/**
* This is a HMAC-SHA1 specific value.
@@ -76,7 +76,7 @@ class Net_OpenID_Association {
{
$issued = time();
$lifetime = $expires_in;
- return new Net_OpenID_Association($handle, $secret,
+ return new Auth_OpenID_Association($handle, $secret,
$issued, $lifetime, $assoc_type);
}
@@ -102,7 +102,7 @@ class Net_OpenID_Association {
* this time is 'HMAC-SHA1', but new types may be defined in the
* future.
*/
- function Net_OpenID_Association(
+ function Auth_OpenID_Association(
$handle, $secret, $issued, $lifetime, $assoc_type)
{
if ($assoc_type != 'HMAC-SHA1') {
@@ -134,7 +134,7 @@ class Net_OpenID_Association {
}
/**
- * This checks to see if two Net_OpenID_Association instances
+ * This checks to see if two Auth_OpenID_Association instances
* represent the same association.
*
* @return bool $result true if the two instances represent the
@@ -151,7 +151,7 @@ class Net_OpenID_Association {
}
/**
- * This checks to see if two Net_OpenID_Association instances
+ * This checks to see if two Auth_OpenID_Association instances
* represent different associations.
*
* @return bool $result true if the two instances represent
@@ -173,7 +173,7 @@ class Net_OpenID_Association {
$data = array(
'version' => '2',
'handle' => $this->handle,
- 'secret' => Net_OpenID_toBase64($this->secret),
+ 'secret' => Auth_OpenID_toBase64($this->secret),
'issued' => strval(intval($this->issued)),
'lifetime' => strval(intval($this->lifetime)),
'assoc_type' => $this->assoc_type
@@ -181,7 +181,7 @@ class Net_OpenID_Association {
assert(array_keys($data) == $this->assoc_keys);
- return Net_OpenID_KVForm::arrayToKV($data, $strict = true);
+ return Auth_OpenID_KVForm::arrayToKV($data, $strict = true);
}
/**
@@ -189,11 +189,11 @@ class Net_OpenID_Association {
* inverse of serialize.
*
* @param string $assoc_s Association as serialized by serialize()
- * @return Net_OpenID_Association $result instance of this class
+ * @return Auth_OpenID_Association $result instance of this class
*/
function deserialize($class_name, $assoc_s)
{
- $pairs = Net_OpenID_KVForm::kvToArray($assoc_s, $strict = true);
+ $pairs = Auth_OpenID_KVForm::kvToArray($assoc_s, $strict = true);
$keys = array();
$values = array();
foreach ($pairs as $key => $value) {
@@ -222,7 +222,7 @@ class Net_OpenID_Association {
$issued = intval($issued);
$lifetime = intval($lifetime);
- $secret = Net_OpenID_fromBase64($secret);
+ $secret = Auth_OpenID_fromBase64($secret);
return new $class_name(
$handle, $secret, $issued, $lifetime, $assoc_type);
@@ -239,8 +239,8 @@ class Net_OpenID_Association {
function sign($pairs)
{
assert($this->assoc_type == 'HMAC-SHA1');
- $kv = Net_OpenID_KVForm::arrayToKV($pairs);
- return Net_OpenID_hmacSha1($this->secret, $kv);
+ $kv = Auth_OpenID_KVForm::arrayToKV($pairs);
+ return Auth_OpenID_hmacSha1($this->secret, $kv);
}
/**
@@ -259,7 +259,7 @@ class Net_OpenID_Association {
$pairs[] = array($field, $data[$prefix . $field]);
}
- return Net_OpenID_toBase64($this->sign($pairs));
+ return Auth_OpenID_toBase64($this->sign($pairs));
}
function addSignature($fields, &$data, $prefix = 'openid.')
diff --git a/Net/OpenID/Consumer/Consumer.php b/Auth/OpenID/Consumer/Consumer.php
index 64d581a..7ac3ab0 100644
--- a/Net/OpenID/Consumer/Consumer.php
+++ b/Auth/OpenID/Consumer/Consumer.php
@@ -38,7 +38,7 @@
* At a high level, there are two important parts in the consumer
* library. The first important part is this module, which contains
* the interface to actually use this library. The second is the
- * Net_OpenID_Interface class, which describes the interface to use if
+ * Auth_OpenID_Interface class, which describes the interface to use if
* you need to create a custom method for storing the state this
* library needs to maintain between requests.
*
@@ -47,10 +47,10 @@
* which cover a wide variety of situations in which consumers may
* use the library.
*
- * This module contains a class, Net_OpenID_Consumer, with methods
+ * This module contains a class, Auth_OpenID_Consumer, with methods
* corresponding to the actions necessary in each of steps 2, 3, and 4
* described in the overview. Use of this library should be as easy
- * as creating a Net_OpenID_Consumer instance and calling the methods
+ * as creating a Auth_OpenID_Consumer instance and calling the methods
* appropriate for the action the site wants to take.
*
* STORES AND DUMB MODE
@@ -70,7 +70,7 @@
*
* Several store implementation are provided, and the interface is
* fully documented so that custom stores can be used as well. See
- * the documentation for the Net_OpenID_Consumer class for more
+ * the documentation for the Auth_OpenID_Consumer class for more
* information on the interface for stores. The concrete
* implementations that are provided allow the consumer site to store
* the necessary data in several different ways: in the filesystem, in
@@ -114,12 +114,12 @@
* a request to the your site which includes that OpenID URL.
*
* When your site receives that request, it should create an
- * Net_OpenID_Consumer instance, and call beginAuth on it. If
+ * Auth_OpenID_Consumer instance, and call beginAuth on it. If
* beginAuth completes successfully, it will return an
- * Net_OpenID_AuthRequest instance. Otherwise it will provide some
+ * Auth_OpenID_AuthRequest instance. Otherwise it will provide some
* useful information for giving the user an error message.
*
- * Now that you have the Net_OpenID_AuthRequest object, you need to
+ * Now that you have the Auth_OpenID_AuthRequest object, you need to
* preserve the value in its $token field for lookup on the user's
* next request from your site. There are several approaches for
* doing this which will work. If your environment has any kind of
@@ -128,7 +128,7 @@
* or in the return_to url provided in the next step.
*
* The next step is to call the constructRedirect method on the
- * Net_OpenID_Consumer object. Pass it the Net_OpenID_AuthRequest
+ * Auth_OpenID_Consumer object. Pass it the Auth_OpenID_AuthRequest
* object returned by the previous call to beginAuth along with the
* return_to and trust_root URLs. The return_to URL is the URL that
* the OpenID server will send the user back to after attempting to
@@ -157,7 +157,7 @@
* proceed.
* Otherwise, the next step is to extract the token value set in the
- * first half of the OpenID login. Create a Net_OpenID_Consumer
+ * first half of the OpenID login. Create a Auth_OpenID_Consumer
* object, and call its completeAuth method with that token and a
* dictionary of all the query arguments. This call will return a
* status code and some additional information describing the the
@@ -183,65 +183,65 @@
/**
* Require utility classes and functions for the consumer.
*/
-require_once("Net/OpenID/CryptUtil.php");
-require_once("Net/OpenID/KVForm.php");
-require_once("Net/OpenID/OIDUtil.php");
-require_once("Net/OpenID/Association.php");
-require_once("Net/OpenID/DiffieHellman.php");
-require_once("Net/OpenID/Consumer/Parse.php");
-require_once("Net/OpenID/Consumer/Fetchers.php");
+require_once("Auth/OpenID/CryptUtil.php");
+require_once("Auth/OpenID/KVForm.php");
+require_once("Auth/OpenID/OIDUtil.php");
+require_once("Auth/OpenID/Association.php");
+require_once("Auth/OpenID/DiffieHellman.php");
+require_once("Auth/OpenID/Consumer/Parse.php");
+require_once("Auth/OpenID/Consumer/Fetchers.php");
/**
* This is the status code returned when either the of the beginAuth
* or completeAuth methods return successfully.
*/
-$Net_OpenID_SUCCESS = 'success';
+$Auth_OpenID_SUCCESS = 'success';
/**
* This is the status code completeAuth returns when the value it
* received indicated an invalid login.
*/
-$Net_OpenID_FAILURE = 'failure';
+$Auth_OpenID_FAILURE = 'failure';
/**
* This is the status code completeAuth returns when the
- * Net_OpenID_Consumer instance is in immediate mode, and the identity
+ * Auth_OpenID_Consumer instance is in immediate mode, and the identity
* server sends back a URL to send the user to to complete his or her
* login.
*/
-$Net_OpenID_SETUP_NEEDED = 'setup needed';
+$Auth_OpenID_SETUP_NEEDED = 'setup needed';
/**
* This is the status code beginAuth returns when it is unable to
* fetch the OpenID URL the user entered.
*/
-$Net_OpenID_HTTP_FAILURE = 'http failure';
+$Auth_OpenID_HTTP_FAILURE = 'http failure';
/**
* This is the status code beginAuth returns when the page fetched
* from the entered OpenID URL doesn't contain the necessary link tags
* to function as an identity page.
*/
-$Net_OpenID_PARSE_ERROR = 'parse error';
+$Auth_OpenID_PARSE_ERROR = 'parse error';
/**
* This is the characters that the nonces are made from.
*/
-$_Net_OpenID_NONCE_CHRS = $GLOBALS['_Net_OpenID_letters'] .
- $GLOBALS['_Net_OpenID_digits'];
+$_Auth_OpenID_NONCE_CHRS = $GLOBALS['_Auth_OpenID_letters'] .
+ $GLOBALS['_Auth_OpenID_digits'];
/**
* This is the number of seconds the tokens generated by this library
* will be valid for. If you want to change the lifetime of a token,
* set this value to the desired lifespan, in seconds.
*/
-$_Net_OpenID_TOKEN_LIFETIME = 60 * 5; // five minutes
+$_Auth_OpenID_TOKEN_LIFETIME = 60 * 5; // five minutes
/**
* This is the number of characters in the generated nonce for each
* transaction.
*/
-$_Net_OpenID_NONCE_LEN = 8;
+$_Auth_OpenID_NONCE_LEN = 8;
/**
* This class is the interface to the OpenID consumer logic.
@@ -250,26 +250,26 @@ $_Net_OpenID_NONCE_LEN = 8;
*
* @package OpenID
*/
-class Net_OpenID_Consumer {
+class Auth_OpenID_Consumer {
/**
- * This method initializes a new Net_OpenID_Consumer instance to
+ * This method initializes a new Auth_OpenID_Consumer instance to
* access the library.
*
- * @param Net_OpenID_OpenIDStore $store This must be an object
- * that implements the interface in Net_OpenID_Store. Several
+ * @param Auth_OpenID_OpenIDStore $store This must be an object
+ * that implements the interface in Auth_OpenID_Store. Several
* concrete implementations are provided, to cover most common use
* cases. For stores backed by MySQL, PostgreSQL, or SQLite, see
- * the Net_OpenID_SQLStore class and its sublcasses. For a
- * filesystem-backed store, see the Net_OpenID_FileStore module.
+ * the Auth_OpenID_SQLStore class and its sublcasses. For a
+ * filesystem-backed store, see the Auth_OpenID_FileStore module.
* As a last resort, if it isn't possible for the server to store
- * state at all, an instance of Net_OpenID_DumbStore can be used.
+ * state at all, an instance of Auth_OpenID_DumbStore can be used.
* This should be an absolute last resort, though, as it makes the
* consumer vulnerable to replay attacks over the lifespan of the
* tokens the library creates.
*
- * @param Net_OpenID_HTTPFetcher $fetcher This is an optional
- * reference to an instance of Net_OpenID_HTTPFetcher. If
+ * @param Auth_OpenID_HTTPFetcher $fetcher This is an optional
+ * reference to an instance of Auth_OpenID_HTTPFetcher. If
* present, the provided fetcher is used by the library to fetch
* users' identity pages and make direct requests to the identity
* server. If it is not present, a default fetcher is used. The
@@ -281,7 +281,7 @@ class Net_OpenID_Consumer {
* in the module description. The default value is False, which
* disables immediate mode.
*/
- function Net_OpenID_Consumer(&$store, $fetcher = null, $immediate = false)
+ function Auth_OpenID_Consumer(&$store, $fetcher = null, $immediate = false)
{
if ($store === null) {
trigger_error("Must supply non-null store to create consumer",
@@ -292,7 +292,7 @@ class Net_OpenID_Consumer {
$this->store =& $store;
if ($fetcher === null) {
- $this->fetcher = Net_OpenID_getHTTPFetcher();
+ $this->fetcher = Auth_OpenID_getHTTPFetcher();
} else {
$this->fetcher =& $fetcher;
}
@@ -312,8 +312,8 @@ class Net_OpenID_Consumer {
* First, the user's claimed identity page is fetched, to
* determine their identity server. If the page cannot be fetched
* or if the page does not have the necessary link tags in it,
- * this method returns one of $Net_OpenID_HTTP_FAILURE or
- * $Net_OpenID_PARSE_ERROR, depending on where the process failed.
+ * this method returns one of $Auth_OpenID_HTTP_FAILURE or
+ * $Auth_OpenID_PARSE_ERROR, depending on where the process failed.
*
* Second, unless the store provided is a dumb store, it checks to
* see if it has an association with that identity server, and
@@ -343,7 +343,7 @@ class Net_OpenID_Consumer {
* status code and additional information about the code.
*
* If there was a problem fetching the identity page the user
- * gave, the status code is set to $Net_OpenID_HTTP_FAILURE, and
+ * gave, the status code is set to $Auth_OpenID_HTTP_FAILURE, and
* the additional information value is either set to null if the
* HTTP transaction failed or the HTTP return code, which will be
* in the 400-500 range. This additional information value may
@@ -351,13 +351,13 @@ class Net_OpenID_Consumer {
*
* If the identity page fetched successfully, but didn't include
* the correct link tags, the status code is set to
- * $Net_OpenID_PARSE_ERROR, and the additional information value
+ * $Auth_OpenID_PARSE_ERROR, and the additional information value
* is currently set to null. The additional information value may
* change in a future release.
*
- * Otherwise, the status code is set to $Net_OpenID_SUCCESS, and
+ * Otherwise, the status code is set to $Auth_OpenID_SUCCESS, and
* the additional information is an instance of
- * Net_OpenID_AuthRequest. The $token attribute contains the
+ * Auth_OpenID_AuthRequest. The $token attribute contains the
* token to be preserved for the next HTTP request. The
* $server_url might also be of interest, if you wish to blacklist
* or whitelist OpenID servers. The other contents of the object
@@ -365,10 +365,10 @@ class Net_OpenID_Consumer {
*/
function beginAuth($user_url)
{
- global $Net_OpenID_SUCCESS;
+ global $Auth_OpenID_SUCCESS;
list($status, $info) = $this->_findIdentityInfo($user_url);
- if ($status != $Net_OpenID_SUCCESS) {
+ if ($status != $Auth_OpenID_SUCCESS) {
return array($status, $info);
}
@@ -383,8 +383,8 @@ class Net_OpenID_Consumer {
* The generated redirect should be sent to the browser which
* initiated the authorization request.
*
- * @param Net_OpenID_AuthRequest $auth_request This must be a
- * Net_OpenID_AuthRequest instance which was returned from a
+ * @param Auth_OpenID_AuthRequest $auth_request This must be a
+ * Auth_OpenID_AuthRequest instance which was returned from a
* previous call to beginAuth. It contains information found
* during the beginAuth call which is needed to build the redirect
* URL.
@@ -455,23 +455,23 @@ class Net_OpenID_Consumer {
* The return value is a pair, consisting of a status and
* additional information. The status values are strings, but
* should be referred to by their symbolic values:
- * $Net_OpenID_SUCCESS, $Net_OpenID_FAILURE, and
- * $Net_OpenID_SETUP_NEEDED.
+ * $Auth_OpenID_SUCCESS, $Auth_OpenID_FAILURE, and
+ * $Auth_OpenID_SETUP_NEEDED.
*
- * When $Net_OpenID_SUCCESS is returned, the additional
+ * When $Auth_OpenID_SUCCESS is returned, the additional
* information returned is either null or a string. If it is
* null, it means the user cancelled the login, and no further
* information can be determined. If the additional information
* is a string, it is the identity that has been verified as
* belonging to the user making this request.
*
- * When $Net_OpenID_FAILURE is returned, the additional
+ * When $Auth_OpenID_FAILURE is returned, the additional
* information is either null or a string. In either case, this
* code means that the identity verification failed. If it can be
* determined, the identity that failed to verify is returned.
* Otherwise null is returned.
*
- * When $Net_OpenID_SETUP_NEEDED is returned, the additional
+ * When $Auth_OpenID_SETUP_NEEDED is returned, the additional
* information is the user setup URL. This is a URL returned only
* as a response to requests made with openid.mode=immediate,
* which indicates that the login was unable to proceed, and the
@@ -491,26 +491,26 @@ class Net_OpenID_Consumer {
*/
function completeAuth($token, $query)
{
- global $Net_OpenID_SUCCESS, $Net_OpenID_FAILURE;
+ global $Auth_OpenID_SUCCESS, $Auth_OpenID_FAILURE;
$query = $this->fixResponse($query);
- $mode = Net_OpenID_array_get($query, 'openid.mode', '');
+ $mode = Auth_OpenID_array_get($query, 'openid.mode', '');
if ($mode == 'cancel') {
- return array($Net_OpenID_SUCCESS, null);
+ return array($Auth_OpenID_SUCCESS, null);
} else if ($mode == 'error') {
- $error = Net_OpenID_array_get($query, 'openid.error', null);
+ $error = Auth_OpenID_array_get($query, 'openid.error', null);
if ($error !== null) {
- Net_OpenID_log($error);
+ Auth_OpenID_log($error);
}
- return array($Net_OpenID_FAILURE, null);
+ return array($Auth_OpenID_FAILURE, null);
} else if ($mode == 'id_res') {
return $this->_doIdRes($token, $query);
} else {
- return array($Net_OpenID_FAILURE, null);
+ return array($Auth_OpenID_FAILURE, null);
}
}
@@ -519,16 +519,16 @@ class Net_OpenID_Consumer {
*/
function _gotIdentityInfo($consumer_id, $server_id, $server_url)
{
- global $Net_OpenID_SUCCESS, $_Net_OpenID_NONCE_CHRS,
- $_Net_OpenID_NONCE_LEN;
+ global $Auth_OpenID_SUCCESS, $_Auth_OpenID_NONCE_CHRS,
+ $_Auth_OpenID_NONCE_LEN;
- $nonce = Net_OpenID_CryptUtil::randomString($_Net_OpenID_NONCE_LEN,
- $_Net_OpenID_NONCE_CHRS);
+ $nonce = Auth_OpenID_CryptUtil::randomString($_Auth_OpenID_NONCE_LEN,
+ $_Auth_OpenID_NONCE_CHRS);
$token = $this->_genToken($nonce, $consumer_id,
$server_id, $server_url);
- return array($Net_OpenID_SUCCESS,
- new Net_OpenID_AuthRequest($token, $server_id,
+ return array($Auth_OpenID_SUCCESS,
+ new Auth_OpenID_AuthRequest($token, $server_id,
$server_url, $nonce));
}
@@ -549,7 +549,7 @@ class Net_OpenID_Consumer {
}
$this->store->storeNonce($auth_req->nonce);
- return strval(Net_OpenID_appendArgs($auth_req->server_url,
+ return strval(Auth_OpenID_appendArgs($auth_req->server_url,
$redir_args));
}
@@ -558,36 +558,36 @@ class Net_OpenID_Consumer {
*/
function _doIdRes($token, $query)
{
- global $Net_OpenID_FAILURE, $Net_OpenID_SETUP_NEEDED,
- $Net_OpenID_SUCCESS;
+ global $Auth_OpenID_FAILURE, $Auth_OpenID_SETUP_NEEDED,
+ $Auth_OpenID_SUCCESS;
$ret = $this->_splitToken($token);
if ($ret === null) {
- return array($Net_OpenID_FAILURE, null);
+ return array($Auth_OpenID_FAILURE, null);
}
list($nonce, $consumer_id, $server_id, $server_url) = $ret;
- $return_to = Net_OpenID_array_get($query, 'openid.return_to', null);
- $server_id2 = Net_OpenID_array_get($query, 'openid.identity', null);
- $assoc_handle = Net_OpenID_array_get($query,
+ $return_to = Auth_OpenID_array_get($query, 'openid.return_to', null);
+ $server_id2 = Auth_OpenID_array_get($query, 'openid.identity', null);
+ $assoc_handle = Auth_OpenID_array_get($query,
'openid.assoc_handle', null);
if (($return_to === null) ||
($server_id === null) ||
($assoc_handle === null)) {
- return array($Net_OpenID_FAILURE, $consumer_id);
+ return array($Auth_OpenID_FAILURE, $consumer_id);
}
if ($server_id != $server_id2) {
- return array($Net_OpenID_FAILURE, $consumer_id);
+ return array($Auth_OpenID_FAILURE, $consumer_id);
}
- $user_setup_url = Net_OpenID_array_get($query,
+ $user_setup_url = Auth_OpenID_array_get($query,
'openid.user_setup_url', null);
if ($user_setup_url !== null) {
- return array($Net_OpenID_SETUP_NEEDED, $user_setup_url);
+ return array($Auth_OpenID_SETUP_NEEDED, $user_setup_url);
}
$assoc = $this->store->getAssociation($server_url);
@@ -602,25 +602,25 @@ class Net_OpenID_Consumer {
}
// Check the signature
- $sig = Net_OpenID_array_get($query, 'openid.sig', null);
- $signed = Net_OpenID_array_get($query, 'openid.signed', null);
+ $sig = Auth_OpenID_array_get($query, 'openid.sig', null);
+ $signed = Auth_OpenID_array_get($query, 'openid.signed', null);
if (($sig === null) ||
($signed === null)) {
- return array($Net_OpenID_FAILURE, $consumer_id);
+ return array($Auth_OpenID_FAILURE, $consumer_id);
}
$signed_list = explode(",", $signed);
$v_sig = $assoc->signDict($signed_list, $query);
if ($v_sig != $sig) {
- return array($Net_OpenID_FAILURE, $consumer_id);
+ return array($Auth_OpenID_FAILURE, $consumer_id);
}
if (!$this->store->useNonce($nonce)) {
- return array($Net_OpenID_FAILURE, $consumer_id);
+ return array($Auth_OpenID_FAILURE, $consumer_id);
}
- return array($Net_OpenID_SUCCESS, $consumer_id);
+ return array($Auth_OpenID_SUCCESS, $consumer_id);
}
/**
@@ -628,12 +628,12 @@ class Net_OpenID_Consumer {
*/
function _checkAuth($nonce, $query, $server_url)
{
- global $Net_OpenID_FAILURE, $Net_OpenID_SUCCESS;
+ global $Auth_OpenID_FAILURE, $Auth_OpenID_SUCCESS;
// XXX: send only those arguments that were signed?
- $signed = Net_OpenID_array_get($query, 'openid.signed', null);
+ $signed = Auth_OpenID_array_get($query, 'openid.signed', null);
if ($signed === null) {
- return $Net_OpenID_FAILURE;
+ return $Auth_OpenID_FAILURE;
}
$whitelist = array('assoc_handle', 'sig',
@@ -650,18 +650,18 @@ class Net_OpenID_Consumer {
}
$check_args['openid.mode'] = 'check_authentication';
- $post_data = Net_OpenID_http_build_query($check_args);
+ $post_data = Auth_OpenID_http_build_query($check_args);
$ret = $this->fetcher->post($server_url, $post_data);
if ($ret === null) {
- return $Net_OpenID_FAILURE;
+ return $Auth_OpenID_FAILURE;
}
- $results = Net_OpenID_KVForm::kvToArray($ret[2]);
- $is_valid = Net_OpenID_array_get($results, 'is_valid', 'false');
+ $results = Auth_OpenID_KVForm::kvToArray($ret[2]);
+ $is_valid = Auth_OpenID_array_get($results, 'is_valid', 'false');
if ($is_valid == 'true') {
- $invalidate_handle = Net_OpenID_array_get($results,
+ $invalidate_handle = Auth_OpenID_array_get($results,
'invalidate_handle',
null);
if ($invalidate_handle !== null) {
@@ -670,19 +670,19 @@ class Net_OpenID_Consumer {
}
if (!$this->store->useNonce($nonce)) {
- return $Net_OpenID_FAILURE;
+ return $Auth_OpenID_FAILURE;
}
- return $Net_OpenID_SUCCESS;
+ return $Auth_OpenID_SUCCESS;
}
- $error = Net_OpenID_array_get($results, 'error', null);
+ $error = Auth_OpenID_array_get($results, 'error', null);
if ($error !== null) {
- Net_OpenID_log(sprintf("Error message from server during " .
+ Auth_OpenID_log(sprintf("Error message from server during " .
"check_authentication: %s", error));
}
- return $Net_OpenID_FAILURE;
+ return $Auth_OpenID_FAILURE;
}
/**
@@ -690,7 +690,7 @@ class Net_OpenID_Consumer {
*/
function _getAssociation($server_url, $replace = false)
{
- global $_Net_OpenID_TOKEN_LIFETIME;
+ global $_Auth_OpenID_TOKEN_LIFETIME;
if ($this->store->isDumb()) {
return null;
@@ -700,8 +700,8 @@ class Net_OpenID_Consumer {
if (($assoc === null) ||
($replace && ($assoc->getExpiresIn() <
- $_Net_OpenID_TOKEN_LIFETIME))) {
- $dh = new Net_OpenID_DiffieHellman();
+ $_Auth_OpenID_TOKEN_LIFETIME))) {
+ $dh = new Auth_OpenID_DiffieHellman();
$body = $this->_createAssociateRequest($dh);
$assoc = $this->_fetchAssociation($dh, $server_url, $body);
}
@@ -719,10 +719,10 @@ class Net_OpenID_Consumer {
$consumer_id, $server_id, $server_url);
$joined = implode("\x00", $elements);
- $sig = Net_OpenID_CryptUtil::hmacSha1($this->store->getAuthKey(),
+ $sig = Auth_OpenID_CryptUtil::hmacSha1($this->store->getAuthKey(),
$joined);
- return Net_OpenID_toBase64($sig . $joined);
+ return Auth_OpenID_toBase64($sig . $joined);
}
/**
@@ -730,16 +730,16 @@ class Net_OpenID_Consumer {
*/
function _splitToken($token)
{
- global $_Net_OpenID_TOKEN_LIFETIME;
+ global $_Auth_OpenID_TOKEN_LIFETIME;
- $token = Net_OpenID_fromBase64($token);
+ $token = Auth_OpenID_fromBase64($token);
if (strlen($token) < 20) {
return null;
}
$sig = substr($token, 0, 20);
$joined = substr($token, 20);
- if (Net_OpenID_CryptUtil::hmacSha1(
+ if (Auth_OpenID_CryptUtil::hmacSha1(
$this->store->getAuthKey(), $joined) != $sig) {
return null;
}
@@ -754,7 +754,7 @@ class Net_OpenID_Consumer {
return null;
}
- if ($ts + $_Net_OpenID_TOKEN_LIFETIME < time()) {
+ if ($ts + $_Auth_OpenID_TOKEN_LIFETIME < time()) {
return null;
}
@@ -766,17 +766,17 @@ class Net_OpenID_Consumer {
*/
function _findIdentityInfo($identity_url)
{
- global $Net_OpenID_HTTP_FAILURE;
+ global $Auth_OpenID_HTTP_FAILURE;
- $url = Net_OpenID_normalizeUrl($identity_url);
+ $url = Auth_OpenID_normalizeUrl($identity_url);
$ret = $this->fetcher->get($url);
if ($ret === null) {
- return array($Net_OpenID_HTTP_FAILURE, null);
+ return array($Auth_OpenID_HTTP_FAILURE, null);
}
list($http_code, $consumer_id, $data) = $ret;
if ($http_code != 200) {
- return array($Net_OpenID_HTTP_FAILURE, $http_code);
+ return array($Auth_OpenID_HTTP_FAILURE, $http_code);
}
// This method is split in two this way to allow for
@@ -789,14 +789,14 @@ class Net_OpenID_Consumer {
*/
function _parseIdentityInfo($data, $consumer_id)
{
- global $Net_OpenID_PARSE_ERROR, $Net_OpenID_SUCCESS;
+ global $Auth_OpenID_PARSE_ERROR, $Auth_OpenID_SUCCESS;
- $link_attrs = Net_OpenID_parseLinkAttrs($data);
- $server = Net_OpenID_findFirstHref($link_attrs, 'openid.server');
- $delegate = Net_OpenID_findFirstHref($link_attrs, 'openid.delegate');
+ $link_attrs = Auth_OpenID_parseLinkAttrs($data);
+ $server = Auth_OpenID_findFirstHref($link_attrs, 'openid.server');
+ $delegate = Auth_OpenID_findFirstHref($link_attrs, 'openid.delegate');
if ($server === null) {
- return array($Net_OpenID_PARSE_ERROR, null);
+ return array($Auth_OpenID_PARSE_ERROR, null);
}
if ($delegate !== null) {
@@ -810,10 +810,10 @@ class Net_OpenID_Consumer {
$normalized = array();
foreach ($urls as $url) {
- $normalized[] = Net_OpenID_normalizeUrl($url);
+ $normalized[] = Auth_OpenID_normalizeUrl($url);
}
- return array($Net_OpenID_SUCCESS, $normalized);
+ return array($Auth_OpenID_SUCCESS, $normalized);
}
/**
@@ -821,13 +821,13 @@ class Net_OpenID_Consumer {
*/
function _createAssociateRequest($dh, $args = null)
{
- global $_Net_OpenID_DEFAULT_MOD, $_Net_OpenID_DEFAULT_GEN;
+ global $_Auth_OpenID_DEFAULT_MOD, $_Auth_OpenID_DEFAULT_GEN;
if ($args === null) {
$args = array();
}
- $cpub = Net_OpenID_CryptUtil::longToBase64($dh->public);
+ $cpub = Auth_OpenID_CryptUtil::longToBase64($dh->public);
$args = array_merge($args, array(
'openid.mode' => 'associate',
@@ -836,18 +836,18 @@ class Net_OpenID_Consumer {
'openid.dh_consumer_public' => $cpub
));
- if (($dh->mod != $_Net_OpenID_DEFAULT_MOD) ||
- ($dh->gen != $_Net_OpenID_DEFAULT_GEN)) {
+ if (($dh->mod != $_Auth_OpenID_DEFAULT_MOD) ||
+ ($dh->gen != $_Auth_OpenID_DEFAULT_GEN)) {
$args = array_merge($args,
array(
'openid.dh_modulus' =>
- Net_OpenID_CryptUtil::longToBase64($dh->modulus),
+ Auth_OpenID_CryptUtil::longToBase64($dh->modulus),
'openid.dh_gen' =>
- Net_OpenID_CryptUtil::longToBase64($dh->generator)
+ Auth_OpenID_CryptUtil::longToBase64($dh->generator)
));
}
- return Net_OpenID_http_build_query($args);
+ return Auth_OpenID_http_build_query($args);
}
/**
@@ -858,26 +858,26 @@ class Net_OpenID_Consumer {
$ret = $this->fetcher->post($server_url, $body);
if ($ret === null) {
$fmt = 'Getting association: failed to fetch URL: %s';
- Net_OpenID_log(sprintf($fmt, $server_url));
+ Auth_OpenID_log(sprintf($fmt, $server_url));
return null;
}
list($http_code, $url, $data) = $ret;
- $results = Net_OpenID_KVForm::kvToArray($data);
+ $results = Auth_OpenID_KVForm::kvToArray($data);
if ($http_code == 400) {
- $server_error = Net_OpenID_array_get($results, 'error',
+ $server_error = Auth_OpenID_array_get($results, 'error',
'<no message from server>');
$fmt = 'Getting association: error returned from server %s: %s';
- Net_OpenID_log(sprintf($fmt, $server_url, $server_error));
+ Auth_OpenID_log(sprintf($fmt, $server_url, $server_error));
return null;
} else if ($http_code != 200) {
$fmt = 'Getting association: bad status code from server %s: %s';
- Net_OpenID_log(sprintf($fmt, $server_url, $http_code));
+ Auth_OpenID_log(sprintf($fmt, $server_url, $http_code));
return null;
}
- $results = Net_OpenID_KVForm::kvToArray($data);
+ $results = Auth_OpenID_KVForm::kvToArray($data);
return $this->_parseAssociation($results, $dh, $server_url);
}
@@ -892,7 +892,7 @@ class Net_OpenID_Consumer {
foreach ($required_keys as $key) {
if (!array_key_exists($key, $results)) {
- Net_OpenID_log(sprintf("Getting association: missing key in ".
+ Auth_OpenID_log(sprintf("Getting association: missing key in ".
"response from %s: %s",
$server_url, $key),
E_USER_WARNING);
@@ -903,33 +903,34 @@ class Net_OpenID_Consumer {
$assoc_type = $results['assoc_type'];
if ($assoc_type != 'HMAC-SHA1') {
$fmt = 'Unsupported assoc_type returned from server %s: %s';
- Net_OpenID_log(sprintf($fmt, $server_url, $assoc_type));
+ Auth_OpenID_log(sprintf($fmt, $server_url, $assoc_type));
return null;
}
$assoc_handle = $results['assoc_handle'];
- $expires_in = intval(Net_OpenID_array_get($results, 'expires_in', '0'));
+ $expires_in = intval(Auth_OpenID_array_get($results, 'expires_in',
+ '0'));
- $session_type = Net_OpenID_array_get($results, 'session_type', null);
+ $session_type = Auth_OpenID_array_get($results, 'session_type', null);
if ($session_type === null) {
- $secret = Net_OpenID_fromBase64($results['mac_key']);
+ $secret = Auth_OpenID_fromBase64($results['mac_key']);
} else {
$fmt = 'Unsupported session_type returned from server %s: %s';
if ($session_type != 'DH-SHA1') {
- Net_OpenID_log(sprintf($fmt, $server_url, $session_type));
+ Auth_OpenID_log(sprintf($fmt, $server_url, $session_type));
return null;
}
- $spub = Net_OpenID_CryptUtil::base64ToLong(
+ $spub = Auth_OpenID_CryptUtil::base64ToLong(
$results['dh_server_public']);
- $enc_mac_key = Net_OpenID_CryptUtil::fromBase64(
+ $enc_mac_key = Auth_OpenID_CryptUtil::fromBase64(
$results['enc_mac_key']);
$secret = $dh->xorSecret($spub, $enc_mac_key);
}
- $assoc = Net_OpenID_Association::fromExpiresIn($expires_in,
+ $assoc = Auth_OpenID_Association::fromExpiresIn($expires_in,
$assoc_handle,
$secret,
$assoc_type);
@@ -959,8 +960,8 @@ class Net_OpenID_Consumer {
*
* @package OpenID
*/
-class Net_OpenID_AuthRequest {
- function Net_OpenID_AuthRequest($token, $server_id, $server_url, $nonce)
+class Auth_OpenID_AuthRequest {
+ function Auth_OpenID_AuthRequest($token, $server_id, $server_url, $nonce)
{
$this->token = $token;
$this->server_id = $server_id;
@@ -969,4 +970,4 @@ class Net_OpenID_AuthRequest {
}
}
-?> \ No newline at end of file
+?>
diff --git a/Net/OpenID/Consumer/Fetchers.php b/Auth/OpenID/Consumer/Fetchers.php
index 5b3afb3..6918fc5 100644
--- a/Net/OpenID/Consumer/Fetchers.php
+++ b/Auth/OpenID/Consumer/Fetchers.php
@@ -17,12 +17,12 @@
/**
* Specify a socket timeout setting, in seconds.
*/
-$_Net_OpenID_socket_timeout = 20;
+$_Auth_OpenID_socket_timeout = 20;
/**
* Specify allowed URL schemes for fetching.
*/
-$_Net_OpenID_allowed_schemes = array('http', 'https');
+$_Auth_OpenID_allowed_schemes = array('http', 'https');
/**
* This class is the interface for HTTP fetchers the OpenID consumer
@@ -31,7 +31,7 @@ $_Net_OpenID_allowed_schemes = array('http', 'https');
*
* @package OpenID
*/
-class Net_OpenID_HTTPFetcher {
+class Auth_OpenID_HTTPFetcher {
/**
* This performs an HTTP get, following redirects along the way.
@@ -66,27 +66,27 @@ class Net_OpenID_HTTPFetcher {
/**
* Detect the presence of Curl and set a flag accordingly.
*/
-$_Net_OpenID_curl_found = false;
+$_Auth_OpenID_curl_found = false;
if (function_exists('curl_init')) {
- $_Net_OpenID_curl_found = true;
+ $_Auth_OpenID_curl_found = true;
}
-function Net_OpenID_getHTTPFetcher()
+function Auth_OpenID_getHTTPFetcher()
{
- global $_Net_OpenID_curl_found;
- if (!$_Net_OpenID_curl_found) {
- $fetcher = new Net_OpenID_PlainHTTPFetcher();
+ global $_Auth_OpenID_curl_found;
+ if (!$_Auth_OpenID_curl_found) {
+ $fetcher = new Auth_OpenID_PlainHTTPFetcher();
} else {
- $fetcher = new Net_OpenID_ParanoidHTTPFetcher();
+ $fetcher = new Auth_OpenID_ParanoidHTTPFetcher();
}
return $fetcher;
}
-function Net_OpenID_allowedURL($url)
+function Auth_OpenID_allowedURL($url)
{
- global $_Net_OpenID_allowed_schemes;
- foreach ($_Net_OpenID_allowed_schemes as $scheme) {
+ global $_Auth_OpenID_allowed_schemes;
+ foreach ($_Auth_OpenID_allowed_schemes as $scheme) {
if (strpos($url, sprintf("%s://", $scheme)) == 0) {
return true;
}
@@ -101,7 +101,7 @@ function Net_OpenID_allowedURL($url)
*
* @package OpenID
*/
-class Net_OpenID_PlainHTTPFetcher extends Net_OpenID_HTTPFetcher {
+class Auth_OpenID_PlainHTTPFetcher extends Auth_OpenID_HTTPFetcher {
/**
* @access private
*/
@@ -118,7 +118,7 @@ class Net_OpenID_PlainHTTPFetcher extends Net_OpenID_HTTPFetcher {
function get($url)
{
- if (!Net_OpenID_allowedURL($url)) {
+ if (!Auth_OpenID_allowedURL($url)) {
trigger_error("Bad URL scheme in url: " . $url,
E_USER_WARNING);
return null;
@@ -129,9 +129,9 @@ class Net_OpenID_PlainHTTPFetcher extends Net_OpenID_HTTPFetcher {
function post($url, $body)
{
- global $_Net_OpenID_socket_timeout;
+ global $_Auth_OpenID_socket_timeout;
- if (!Net_OpenID_allowedURL($url)) {
+ if (!Auth_OpenID_allowedURL($url)) {
trigger_error("Bad URL scheme in url: " . $url,
E_USER_WARNING);
return null;
@@ -169,7 +169,7 @@ class Net_OpenID_PlainHTTPFetcher extends Net_OpenID_HTTPFetcher {
// Connect to the remote server.
$sock = fsockopen($parts['host'], $parts['port']);
- stream_set_timeout($sock, $_Net_OpenID_socket_timeout);
+ stream_set_timeout($sock, $_Auth_OpenID_socket_timeout);
if ($sock === false) {
trigger_error("Could not connect to " . $parts['host'] .
@@ -209,19 +209,19 @@ class Net_OpenID_PlainHTTPFetcher extends Net_OpenID_HTTPFetcher {
/**
* An array to store headers and data from Curl calls.
*/
-$_Net_OpenID_curl_data = array();
+$_Auth_OpenID_curl_data = array();
/**
- * A function to prepare a "slot" in the global $_Net_OpenID_curl_data
+ * A function to prepare a "slot" in the global $_Auth_OpenID_curl_data
* array so curl data can be stored there by curl callbacks in the
* paranoid fetcher.
*/
function _initResponseSlot($ch)
{
- global $_Net_OpenID_curl_data;
+ global $_Auth_OpenID_curl_data;
$key = strval($ch);
- if (!array_key_exists($key, $_Net_OpenID_curl_data)) {
- $_Net_OpenID_curl_data[$key] = array('headers' => array(),
+ if (!array_key_exists($key, $_Auth_OpenID_curl_data)) {
+ $_Auth_OpenID_curl_data[$key] = array('headers' => array(),
'body' => "");
}
return $key;
@@ -232,9 +232,9 @@ function _initResponseSlot($ch)
*/
function _writeHeaders($ch, $data)
{
- global $_Net_OpenID_curl_data;
+ global $_Auth_OpenID_curl_data;
$key = _initResponseSlot($ch);
- $_Net_OpenID_curl_data[$key]['headers'][] = rtrim($data);
+ $_Auth_OpenID_curl_data[$key]['headers'][] = rtrim($data);
return strlen($data);
}
@@ -243,24 +243,24 @@ function _writeHeaders($ch, $data)
*/
function _writeData($ch, $data)
{
- global $_Net_OpenID_curl_data;
+ global $_Auth_OpenID_curl_data;
$key = _initResponseSlot($ch);
- $_Net_OpenID_curl_data[$key]['body'] .= $data;
+ $_Auth_OpenID_curl_data[$key]['body'] .= $data;
return strlen($data);
}
/**
- * A paranoid Net_OpenID_HTTPFetcher class which uses CURL for
+ * A paranoid Auth_OpenID_HTTPFetcher class which uses CURL for
* fetching.
*
* @package OpenID
*/
-class Net_OpenID_ParanoidHTTPFetcher extends Net_OpenID_HTTPFetcher {
- function Net_OpenID_ParanoidHTTPFetcher()
+class Auth_OpenID_ParanoidHTTPFetcher extends Auth_OpenID_HTTPFetcher {
+ function Auth_OpenID_ParanoidHTTPFetcher()
{
- global $_Net_OpenID_curl_found;
- if (!$_Net_OpenID_curl_found) {
+ global $_Auth_OpenID_curl_found;
+ if (!$_Auth_OpenID_curl_found) {
trigger_error("Cannot use this class; CURL extension not found",
E_USER_ERROR);
}
@@ -282,8 +282,8 @@ class Net_OpenID_ParanoidHTTPFetcher extends Net_OpenID_HTTPFetcher {
function get($url)
{
- global $_Net_OpenID_socket_timeout;
- global $_Net_OpenID_curl_data;
+ global $_Auth_OpenID_socket_timeout;
+ global $_Auth_OpenID_curl_data;
$c = curl_init();
@@ -291,11 +291,11 @@ class Net_OpenID_ParanoidHTTPFetcher extends Net_OpenID_HTTPFetcher {
curl_setopt($c, CURLOPT_NOSIGNAL, true);
- $stop = time() + $_Net_OpenID_socket_timeout;
- $off = $_Net_OpenID_socket_timeout;
+ $stop = time() + $_Auth_OpenID_socket_timeout;
+ $off = $_Auth_OpenID_socket_timeout;
while ($off > 0) {
- if (!Net_OpenID_allowedURL($url)) {
+ if (!Auth_OpenID_allowedURL($url)) {
trigger_error(sprintf("Fetching URL not allowed: %s", $url),
E_USER_WARNING);
return null;
@@ -309,8 +309,8 @@ class Net_OpenID_ParanoidHTTPFetcher extends Net_OpenID_HTTPFetcher {
curl_exec($c);
$code = curl_getinfo($c, CURLINFO_HTTP_CODE);
- $body = $_Net_OpenID_curl_data[$curl_key]['body'];
- $headers = $_Net_OpenID_curl_data[$curl_key]['headers'];
+ $body = $_Auth_OpenID_curl_data[$curl_key]['body'];
+ $headers = $_Auth_OpenID_curl_data[$curl_key]['headers'];
if (!$code) {
trigger_error("No HTTP code returned", E_USER_WARNING);
@@ -335,10 +335,10 @@ class Net_OpenID_ParanoidHTTPFetcher extends Net_OpenID_HTTPFetcher {
function post($url, $body)
{
- global $_Net_OpenID_socket_timeout;
- global $_Net_OpenID_curl_data;
+ global $_Auth_OpenID_socket_timeout;
+ global $_Auth_OpenID_curl_data;
- if (!Net_OpenID_allowedURL($url)) {
+ if (!Auth_OpenID_allowedURL($url)) {
trigger_error(sprintf("Fetching URL not allowed: %s", $url),
E_USER_WARNING);
return null;
@@ -351,7 +351,7 @@ class Net_OpenID_ParanoidHTTPFetcher extends Net_OpenID_HTTPFetcher {
curl_setopt($c, CURLOPT_NOSIGNAL, true);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $body);
- curl_setopt($c, CURLOPT_TIMEOUT, $_Net_OpenID_socket_timeout);
+ curl_setopt($c, CURLOPT_TIMEOUT, $_Auth_OpenID_socket_timeout);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_WRITEFUNCTION, "_writeData");
@@ -364,7 +364,7 @@ class Net_OpenID_ParanoidHTTPFetcher extends Net_OpenID_HTTPFetcher {
return null;
}
- $body = $_Net_OpenID_curl_data[$curl_key]['body'];
+ $body = $_Auth_OpenID_curl_data[$curl_key]['body'];
curl_close($c);
return array($code, $url, $body);
diff --git a/Net/OpenID/Consumer/Parse.php b/Auth/OpenID/Consumer/Parse.php
index 5d63234..69f386f 100644
--- a/Net/OpenID/Consumer/Parse.php
+++ b/Auth/OpenID/Consumer/Parse.php
@@ -81,12 +81,12 @@
/**
* Specify some flags for use with regex matching.
*/
-$_Net_OpenID_re_flags = "si";
+$_Auth_OpenID_re_flags = "si";
/**
* Stuff to remove before we start looking for tags
*/
-$_Net_OpenID_removed_re = "<!--.*?-->|" .
+$_Auth_OpenID_removed_re = "<!--.*?-->|" .
"<!\[CDATA\[.*?\]\]>|" .
"<script\b(?!:)[^>]*>.*?<\/script>";
@@ -94,7 +94,7 @@ $_Net_OpenID_removed_re = "<!--.*?-->|" .
* Starts with the tag name at a word boundary, where the tag name is
* not a namespace
*/
-$_Net_OpenID_tag_expr = "<%s\b(?!:)([^>]*?)" .
+$_Auth_OpenID_tag_expr = "<%s\b(?!:)([^>]*?)" .
"(?:\/>|>(.*?)" .
"(?:<\/?%s\s*>|\Z))";
@@ -102,9 +102,9 @@ $_Net_OpenID_tag_expr = "<%s\b(?!:)([^>]*?)" .
* Returns a regular expression that will match a given tag in an SGML
* string.
*/
-function Net_OpenID_tagMatcher($tag_name, $close_tags = null)
+function Auth_OpenID_tagMatcher($tag_name, $close_tags = null)
{
- global $_Net_OpenID_tag_expr, $_Net_OpenID_re_flags;
+ global $_Auth_OpenID_tag_expr, $_Auth_OpenID_re_flags;
if ($close_tags) {
$options = implode("|", array_merge(array($tag_name), $close_tags));
@@ -113,54 +113,54 @@ function Net_OpenID_tagMatcher($tag_name, $close_tags = null)
$closer = $tag_name;
}
- $expr = sprintf($_Net_OpenID_tag_expr, $tag_name, $closer);
- return sprintf("/%s/%s", $expr, $_Net_OpenID_re_flags);
+ $expr = sprintf($_Auth_OpenID_tag_expr, $tag_name, $closer);
+ return sprintf("/%s/%s", $expr, $_Auth_OpenID_re_flags);
}
-function Net_OpenID_html_find()
+function Auth_OpenID_html_find()
{
- return Net_OpenID_tagMatcher('html');
+ return Auth_OpenID_tagMatcher('html');
}
-function Net_OpenID_head_find()
+function Auth_OpenID_head_find()
{
- return Net_OpenID_tagMatcher('head', array('body'));
+ return Auth_OpenID_tagMatcher('head', array('body'));
}
-$_Net_OpenID_attr_find = '\b(\w+)=("[^"]*"|\'[^\']*\'|[^\'"\s\/<>]+)';
+$_Auth_OpenID_attr_find = '\b(\w+)=("[^"]*"|\'[^\']*\'|[^\'"\s\/<>]+)';
-$_Net_OpenID_link_find = sprintf("/<link\b(?!:)([^>]*)(?!<)>/%s",
- $_Net_OpenID_re_flags);
+$_Auth_OpenID_link_find = sprintf("/<link\b(?!:)([^>]*)(?!<)>/%s",
+ $_Auth_OpenID_re_flags);
-$_Net_OpenID_entity_replacements = array(
+$_Auth_OpenID_entity_replacements = array(
'amp' => '&',
'lt' => '<',
'gt' => '>',
'quot' => '"'
);
-$_Net_OpenID_attr_find = sprintf("/%s/%s",
- $_Net_OpenID_attr_find,
- $_Net_OpenID_re_flags);
+$_Auth_OpenID_attr_find = sprintf("/%s/%s",
+ $_Auth_OpenID_attr_find,
+ $_Auth_OpenID_re_flags);
-$_Net_OpenID_removed_re = sprintf("/%s/%s",
- $_Net_OpenID_removed_re,
- $_Net_OpenID_re_flags);
+$_Auth_OpenID_removed_re = sprintf("/%s/%s",
+ $_Auth_OpenID_removed_re,
+ $_Auth_OpenID_re_flags);
-$_Net_OpenID_ent_replace =
+$_Auth_OpenID_ent_replace =
sprintf("&(%s);", implode("|",
- $_Net_OpenID_entity_replacements));
+ $_Auth_OpenID_entity_replacements));
-function Net_OpenID_replace_entities($str)
+function Auth_OpenID_replace_entities($str)
{
- global $_Net_OpenID_entity_replacements;
- foreach ($_Net_OpenID_entity_replacements as $old => $new) {
+ global $_Auth_OpenID_entity_replacements;
+ foreach ($_Auth_OpenID_entity_replacements as $old => $new) {
$str = preg_replace(sprintf("/&%s;/", $old), $new, $str);
}
return $str;
}
-function Net_OpenID_remove_quotes($str)
+function Auth_OpenID_remove_quotes($str)
{
$matches = array();
$double = '/^"(.*)"$/';
@@ -183,26 +183,26 @@ function Net_OpenID_remove_quotes($str)
* @return array $list An array of arrays of attributes, one for each
* link tag
*/
-function Net_OpenID_parseLinkAttrs($html)
+function Auth_OpenID_parseLinkAttrs($html)
{
- global $_Net_OpenID_removed_re,
- $_Net_OpenID_link_find,
- $_Net_OpenID_attr_find;
+ global $_Auth_OpenID_removed_re,
+ $_Auth_OpenID_link_find,
+ $_Auth_OpenID_attr_find;
- $stripped = preg_replace($_Net_OpenID_removed_re,
+ $stripped = preg_replace($_Auth_OpenID_removed_re,
"",
$html);
// Try to find the <HTML> tag.
- $html_re = Net_OpenID_html_find();
+ $html_re = Auth_OpenID_html_find();
$html_matches = array();
if (!preg_match($html_re, $stripped, $html_matches)) {
return array();
}
// Try to find the <HEAD> tag.
- $head_re = Net_OpenID_head_find();
+ $head_re = Auth_OpenID_head_find();
$head_matches = array();
if (!preg_match($head_re, $html_matches[0], $head_matches)) {
return array();
@@ -211,19 +211,19 @@ function Net_OpenID_parseLinkAttrs($html)
$link_data = array();
$link_matches = array();
- if (!preg_match_all($_Net_OpenID_link_find, $head_matches[0],
+ if (!preg_match_all($_Auth_OpenID_link_find, $head_matches[0],
$link_matches)) {
return array();
}
foreach ($link_matches[0] as $link) {
$attr_matches = array();
- preg_match_all($_Net_OpenID_attr_find, $link, $attr_matches);
+ preg_match_all($_Auth_OpenID_attr_find, $link, $attr_matches);
$link_attrs = array();
foreach ($attr_matches[0] as $index => $full_match) {
$name = $attr_matches[1][$index];
- $value = Net_OpenID_replace_entities(
- Net_OpenID_remove_quotes(
+ $value = Auth_OpenID_replace_entities(
+ Auth_OpenID_remove_quotes(
$attr_matches[2][$index]));
$link_attrs[$name] = $value;
@@ -234,7 +234,7 @@ function Net_OpenID_parseLinkAttrs($html)
return $link_data;
}
-function Net_OpenID_relMatches($rel_attr, $target_rel)
+function Auth_OpenID_relMatches($rel_attr, $target_rel)
{
// Does this target_rel appear in the rel_str?
// XXX: TESTME
@@ -249,22 +249,22 @@ function Net_OpenID_relMatches($rel_attr, $target_rel)
return 0;
}
-function Net_OpenID_linkHasRel($link_attrs, $target_rel)
+function Auth_OpenID_linkHasRel($link_attrs, $target_rel)
{
// Does this link have target_rel as a relationship?
// XXX: TESTME
- $rel_attr = Net_OpenID_array_get($link_attrs, 'rel', null);
- return ($rel_attr && Net_OpenID_relMatches($rel_attr, $target_rel));
+ $rel_attr = Auth_OpenID_array_get($link_attrs, 'rel', null);
+ return ($rel_attr && Auth_OpenID_relMatches($rel_attr, $target_rel));
}
-function Net_OpenID_findLinksRel($link_attrs_list, $target_rel)
+function Auth_OpenID_findLinksRel($link_attrs_list, $target_rel)
{
// Filter the list of link attributes on whether it has target_rel
// as a relationship.
// XXX: TESTME
$result = array();
foreach ($link_attrs_list as $attr) {
- if (Net_OpenID_linkHasRel($attr, $target_rel)) {
+ if (Auth_OpenID_linkHasRel($attr, $target_rel)) {
$result[] = $attr;
}
}
@@ -272,17 +272,17 @@ function Net_OpenID_findLinksRel($link_attrs_list, $target_rel)
return $result;
}
-function Net_OpenID_findFirstHref($link_attrs_list, $target_rel)
+function Auth_OpenID_findFirstHref($link_attrs_list, $target_rel)
{
// Return the value of the href attribute for the first link tag
// in the list that has target_rel as a relationship.
// XXX: TESTME
- $matches = Net_OpenID_findLinksRel($link_attrs_list, $target_rel);
+ $matches = Auth_OpenID_findLinksRel($link_attrs_list, $target_rel);
if (!$matches) {
return null;
}
$first = $matches[0];
- return Net_OpenID_array_get($first, 'href', null);
+ return Auth_OpenID_array_get($first, 'href', null);
}
?> \ No newline at end of file
diff --git a/Net/OpenID/CryptUtil.php b/Auth/OpenID/CryptUtil.php
index 37073af..a20a5ed 100644
--- a/Net/OpenID/CryptUtil.php
+++ b/Auth/OpenID/CryptUtil.php
@@ -19,21 +19,21 @@
*/
require_once('HMACSHA1.php');
-if (!defined('Net_OpenID_RAND_SOURCE')) {
+if (!defined('Auth_OpenID_RAND_SOURCE')) {
/**
* The filename for a source of random bytes. Define this yourself
* if you have a different source of randomness.
*/
- define('Net_OpenID_RAND_SOURCE', '/dev/urandom');
+ define('Auth_OpenID_RAND_SOURCE', '/dev/urandom');
}
/**
- * Net_OpenID_CryptUtil houses static utility functions.
+ * Auth_OpenID_CryptUtil houses static utility functions.
*
* @package OpenID
* @static
*/
-class Net_OpenID_CryptUtil {
+class Auth_OpenID_CryptUtil {
/**
* Get the specified number of random bytes.
*
@@ -41,7 +41,7 @@ class Net_OpenID_CryptUtil {
* source of randomness if available. If there is no high-entropy
* randomness source available, it will fail. As a last resort,
* for non-critical systems, define
- * <code>Net_OpenID_USE_INSECURE_RAND</code>, and the code will
+ * <code>Auth_OpenID_USE_INSECURE_RAND</code>, and the code will
* fall back on a pseudo-random number generator.
*
* @param int $num_bytes The length of the return value
@@ -50,10 +50,10 @@ class Net_OpenID_CryptUtil {
function getBytes($num_bytes)
{
$bytes = '';
- $f = @fopen(Net_OpenID_RAND_SOURCE, "r");
+ $f = @fopen(Auth_OpenID_RAND_SOURCE, "r");
if ($f === false) {
- if (!defined('Net_OpenID_USE_INSECURE_RAND')) {
- trigger_error('Set Net_OpenID_USE_INSECURE_RAND to ' .
+ if (!defined('Auth_OpenID_USE_INSECURE_RAND')) {
+ trigger_error('Set Auth_OpenID_USE_INSECURE_RAND to ' .
'continue with insecure random.',
E_USER_ERROR);
}
@@ -99,7 +99,7 @@ class Net_OpenID_CryptUtil {
*/
function sha1($str)
{
- return Net_OpenID_sha1_raw($str);
+ return Auth_OpenID_sha1_raw($str);
}
/**
@@ -111,7 +111,7 @@ class Net_OpenID_CryptUtil {
*/
function hmacSha1($key, $text)
{
- return Net_OpenID_HMACSHA1($key, $text);
+ return Auth_OpenID_HMACSHA1($key, $text);
}
/**
@@ -150,7 +150,7 @@ class Net_OpenID_CryptUtil {
function longToBinary($long)
{
- $lib =& Net_OpenID_MathLibrary::getLibWrapper();
+ $lib =& Auth_OpenID_MathLibrary::getLibWrapper();
$cmp = $lib->cmp($long, 0);
if ($cmp < 0) {
@@ -213,7 +213,7 @@ class Net_OpenID_CryptUtil {
*/
function binaryToLong($str)
{
- $lib =& Net_OpenID_MathLibrary::getLibWrapper();
+ $lib =& Auth_OpenID_MathLibrary::getLibWrapper();
if ($str === null) {
return null;
@@ -266,8 +266,8 @@ class Net_OpenID_CryptUtil {
*/
function base64ToLong($str)
{
- return Net_OpenID_CryptUtil::binaryToLong(
- Net_OpenID_CryptUtil::fromBase64($str));
+ return Auth_OpenID_CryptUtil::binaryToLong(
+ Auth_OpenID_CryptUtil::fromBase64($str));
}
/**
@@ -278,8 +278,8 @@ class Net_OpenID_CryptUtil {
*/
function longToBase64($long)
{
- return Net_OpenID_CryptUtil::toBase64(
- Net_OpenID_CryptUtil::longToBinary($long));
+ return Auth_OpenID_CryptUtil::toBase64(
+ Auth_OpenID_CryptUtil::longToBinary($long));
}
/**
@@ -340,8 +340,8 @@ class Net_OpenID_CryptUtil {
function randrange($start, $stop = null, $step = 1)
{
- static $Net_OpenID_CryptUtil_duplicate_cache = array();
- $lib =& Net_OpenID_MathLibrary::getLibWrapper();
+ static $Auth_OpenID_CryptUtil_duplicate_cache = array();
+ $lib =& Auth_OpenID_MathLibrary::getLibWrapper();
if ($stop == null) {
$stop = $start;
@@ -351,11 +351,11 @@ class Net_OpenID_CryptUtil {
$r = $lib->div($lib->sub($stop, $start), $step);
// DO NOT MODIFY THIS VALUE.
- $rbytes = Net_OpenID_CryptUtil::longToBinary($r);
+ $rbytes = Auth_OpenID_CryptUtil::longToBinary($r);
- if (array_key_exists($rbytes, $Net_OpenID_CryptUtil_duplicate_cache)) {
+ if (array_key_exists($rbytes, $Auth_OpenID_CryptUtil_duplicate_cache)) {
list($duplicate, $nbytes) =
- $Net_OpenID_CryptUtil_duplicate_cache[$rbytes];
+ $Auth_OpenID_CryptUtil_duplicate_cache[$rbytes];
} else {
if ($rbytes[0] == "\x00") {
$nbytes = strlen($rbytes) - 1;
@@ -369,17 +369,17 @@ class Net_OpenID_CryptUtil {
// duplicated range.
$duplicate = $lib->mod($mxrand, $r);
- if (count($Net_OpenID_CryptUtil_duplicate_cache) > 10) {
- $Net_OpenID_CryptUtil_duplicate_cache = array();
+ if (count($Auth_OpenID_CryptUtil_duplicate_cache) > 10) {
+ $Auth_OpenID_CryptUtil_duplicate_cache = array();
}
- $Net_OpenID_CryptUtil_duplicate_cache[$rbytes] =
+ $Auth_OpenID_CryptUtil_duplicate_cache[$rbytes] =
array($duplicate, $nbytes);
}
while (1) {
- $bytes = "\x00" . Net_OpenID_CryptUtil::getBytes($nbytes);
- $n = Net_OpenID_CryptUtil::binaryToLong($bytes);
+ $bytes = "\x00" . Auth_OpenID_CryptUtil::getBytes($nbytes);
+ $n = Auth_OpenID_CryptUtil::binaryToLong($bytes);
// Keep looping if this value is in the low duplicated
// range
if ($lib->cmp($n, $duplicate) >= 0) {
@@ -406,7 +406,7 @@ class Net_OpenID_CryptUtil {
function randrange_platform($start, $stop = null, $step = 1)
{
- static $Net_OpenID_CryptUtil_duplicate_cache = array();
+ static $Auth_OpenID_CryptUtil_duplicate_cache = array();
if ($stop == null) {
$stop = $start;
@@ -416,11 +416,11 @@ class Net_OpenID_CryptUtil {
$r = ($stop - $start) / $step;
// DO NOT MODIFY THIS VALUE.
- $rbytes = Net_OpenID_CryptUtil::longToBinary_platform($r);
+ $rbytes = Auth_OpenID_CryptUtil::longToBinary_platform($r);
- if (array_key_exists($rbytes, $Net_OpenID_CryptUtil_duplicate_cache)) {
+ if (array_key_exists($rbytes, $Auth_OpenID_CryptUtil_duplicate_cache)) {
list($duplicate, $nbytes) =
- $Net_OpenID_CryptUtil_duplicate_cache[$rbytes];
+ $Auth_OpenID_CryptUtil_duplicate_cache[$rbytes];
} else {
if ($rbytes[0] == "\x00") {
$nbytes = strlen($rbytes) - 1;
@@ -434,17 +434,17 @@ class Net_OpenID_CryptUtil {
// duplicated range.
$duplicate = $mxrand % $r;
- if (count($Net_OpenID_CryptUtil_duplicate_cache) > 10) {
- $Net_OpenID_CryptUtil_duplicate_cache = array();
+ if (count($Auth_OpenID_CryptUtil_duplicate_cache) > 10) {
+ $Auth_OpenID_CryptUtil_duplicate_cache = array();
}
- $Net_OpenID_CryptUtil_duplicate_cache[$rbytes] =
+ $Auth_OpenID_CryptUtil_duplicate_cache[$rbytes] =
array($duplicate, $nbytes);
}
while (1) {
- $bytes = "\x00" . Net_OpenID_CryptUtil::getBytes($nbytes);
- $n = Net_OpenID_CryptUtil::binaryToLong_platform($bytes);
+ $bytes = "\x00" . Auth_OpenID_CryptUtil::getBytes($nbytes);
+ $n = Auth_OpenID_CryptUtil::binaryToLong_platform($bytes);
// Keep looping if this value is in the low duplicated
// range
if ($n >= $duplicate) {
@@ -469,12 +469,12 @@ class Net_OpenID_CryptUtil {
function randomString($length, $chrs = null)
{
if ($chrs === null) {
- return Net_OpenID_CryptUtil::getBytes($length);
+ return Auth_OpenID_CryptUtil::getBytes($length);
} else {
$n = strlen($chrs);
$str = "";
for ($i = 0; $i < $length; $i++) {
- $str .= $chrs[Net_OpenID_CryptUtil::randrange_platform($n)];
+ $str .= $chrs[Auth_OpenID_CryptUtil::randrange_platform($n)];
}
return $str;
}
@@ -484,22 +484,22 @@ class Net_OpenID_CryptUtil {
/**
* Exposes math library functionality.
*
- * Net_OpenID_MathWrapper is a base class that defines the interface
+ * Auth_OpenID_MathWrapper is a base class that defines the interface
* to a math library like GMP or BCmath. This library will attempt to
* use an available long number implementation. If a library like GMP
- * is found, the appropriate Net_OpenID_MathWrapper subclass will be
+ * is found, the appropriate Auth_OpenID_MathWrapper subclass will be
* instantiated and used for mathematics operations on large numbers.
* This base class wraps only native PHP functionality. See
- * Net_OpenID_MathWrapper subclasses for access to particular long
+ * Auth_OpenID_MathWrapper subclasses for access to particular long
* number implementations.
*
* @package OpenID
*/
-class Net_OpenID_MathWrapper {
+class Auth_OpenID_MathWrapper {
/**
- * The type of the Net_OpenID_MathWrapper class. This value
+ * The type of the Auth_OpenID_MathWrapper class. This value
* describes the library or module being wrapped. Users of
- * Net_OpenID_MathWrapper instances should check this value if
+ * Auth_OpenID_MathWrapper instances should check this value if
* they care about the type of math functionality being exposed.
*/
var $type = 'dumb';
@@ -608,13 +608,13 @@ class Net_OpenID_MathWrapper {
/**
* Exposes BCmath math library functionality.
*
- * Net_OpenID_BcMathWrapper implements the Net_OpenID_MathWrapper
+ * Auth_OpenID_BcMathWrapper implements the Auth_OpenID_MathWrapper
* interface and wraps the functionality provided by the BCMath
* library.
*
* @package OpenID
*/
-class Net_OpenID_BcMathWrapper extends Net_OpenID_MathWrapper {
+class Auth_OpenID_BcMathWrapper extends Auth_OpenID_MathWrapper {
var $type = 'bcmath';
function random($min, $max)
@@ -676,12 +676,12 @@ class Net_OpenID_BcMathWrapper extends Net_OpenID_MathWrapper {
/**
* Exposes GMP math library functionality.
*
- * Net_OpenID_GmpMathWrapper implements the Net_OpenID_MathWrapper
+ * Auth_OpenID_GmpMathWrapper implements the Auth_OpenID_MathWrapper
* interface and wraps the functionality provided by the GMP library.
*
* @package OpenID
*/
-class Net_OpenID_GmpMathWrapper extends Net_OpenID_MathWrapper {
+class Auth_OpenID_GmpMathWrapper extends Auth_OpenID_MathWrapper {
var $type = 'gmp';
function random($min, $max)
@@ -735,7 +735,7 @@ class Net_OpenID_GmpMathWrapper extends Net_OpenID_MathWrapper {
}
}
-$_Net_OpenID___mathLibrary = null;
+$_Auth_OpenID___mathLibrary = null;
/**
* Define the supported extensions. An extension array has keys
@@ -744,70 +744,70 @@ $_Net_OpenID___mathLibrary = null;
* values will be suffixed with a library file extension (e.g. ".so").
* 'extension' is the name of a PHP extension which will be tested
* before 'modules' are loaded. 'class' is the string name of a
- * Net_OpenID_MathWrapper subclass which should be instantiated if a
+ * Auth_OpenID_MathWrapper subclass which should be instantiated if a
* given extension is present.
*
* You can define new math library implementations and add them to
* this array.
*/
-$_Net_OpenID_supported_extensions = array(
+$_Auth_OpenID_supported_extensions = array(
array('modules' => array('gmp', 'php_gmp'),
'extension' => 'gmp',
- 'class' => 'Net_OpenID_GmpMathWrapper'),
+ 'class' => 'Auth_OpenID_GmpMathWrapper'),
array('modules' => array('bcmath', 'php_bcmath'),
'extension' => 'bcmath',
- 'class' => 'Net_OpenID_BcMathWrapper')
+ 'class' => 'Auth_OpenID_BcMathWrapper')
);
/**
- * Net_OpenID_MathLibrary checks for the presence of long number
- * extension modules and returns an instance of Net_OpenID_MathWrapper
+ * Auth_OpenID_MathLibrary checks for the presence of long number
+ * extension modules and returns an instance of Auth_OpenID_MathWrapper
* which exposes the module's functionality.
*
* @static
* @package OpenID
*/
-class Net_OpenID_MathLibrary {
+class Auth_OpenID_MathLibrary {
/**
* A method to access an available long number implementation.
*
* Checks for the existence of an extension module described by
- * the local Net_OpenID_supported_extensions array and returns an
+ * the local Auth_OpenID_supported_extensions array and returns an
* instance of a wrapper for that extension module. If no
* extension module is found, an instance of
- * Net_OpenID_MathWrapper is returned, which wraps the native PHP
+ * Auth_OpenID_MathWrapper is returned, which wraps the native PHP
* integer implementation. The proper calling convention for this
- * method is $lib =& Net_OpenID_MathLibrary::getLibWrapper().
+ * method is $lib =& Auth_OpenID_MathLibrary::getLibWrapper().
*
* This function checks for the existence of specific long number
* implementations in the following order: GMP followed by BCmath.
*
- * @return Net_OpenID_MathWrapper $instance An instance of
- * Net_OpenID_MathWrapper or one of its subclasses
+ * @return Auth_OpenID_MathWrapper $instance An instance of
+ * Auth_OpenID_MathWrapper or one of its subclasses
*/
function &getLibWrapper()
{
- // The instance of Net_OpenID_MathWrapper that we choose to
+ // The instance of Auth_OpenID_MathWrapper that we choose to
// supply will be stored here, so that subseqent calls to this
// method will return a reference to the same object.
- global $_Net_OpenID___mathLibrary;
+ global $_Auth_OpenID___mathLibrary;
- if (defined('Net_OpenID_NO_MATH_SUPPORT')) {
- $_Net_OpenID___mathLibrary = null;
- return $_Net_OpenID___mathLibrary;
+ if (defined('Auth_OpenID_NO_MATH_SUPPORT')) {
+ $_Auth_OpenID___mathLibrary = null;
+ return $_Auth_OpenID___mathLibrary;
}
- global $_Net_OpenID_supported_extensions;
+ global $_Auth_OpenID_supported_extensions;
// If this method has not been called before, look at
- // $Net_OpenID_supported_extensions and try to find an
+ // $Auth_OpenID_supported_extensions and try to find an
// extension that works.
- if (!$_Net_OpenID___mathLibrary) {
+ if (!$_Auth_OpenID___mathLibrary) {
$loaded = false;
$tried = array();
- foreach ($_Net_OpenID_supported_extensions as $extension) {
+ foreach ($_Auth_OpenID_supported_extensions as $extension) {
$tried[] = $extension['extension'];
// See if the extension specified is already loaded.
@@ -827,28 +827,28 @@ class Net_OpenID_MathLibrary {
}
// If the load succeeded, supply an instance of
- // Net_OpenID_MathWrapper which wraps the specified
+ // Auth_OpenID_MathWrapper which wraps the specified
// module's functionality.
if ($loaded) {
$classname = $extension['class'];
- $_Net_OpenID___mathLibrary = new $classname();
+ $_Auth_OpenID___mathLibrary = new $classname();
break;
}
}
// If no extensions were found, fall back to
- // Net_OpenID_MathWrapper so at least some platform-size
+ // Auth_OpenID_MathWrapper so at least some platform-size
// math can be performed.
- if (!$_Net_OpenID___mathLibrary) {
+ if (!$_Auth_OpenID___mathLibrary) {
$triedstr = implode(", ", $tried);
$msg = 'This PHP installation has no big integer math ' .
- 'library. Define Net_OpenID_NO_MATH_SUPPORT to use ' .
+ 'library. Define Auth_OpenID_NO_MATH_SUPPORT to use ' .
'this library in dumb mode. Tried: ' . $triedstr;
trigger_error($msg, E_USER_ERROR);
}
}
- return $_Net_OpenID___mathLibrary;
+ return $_Auth_OpenID___mathLibrary;
}
}
diff --git a/Net/OpenID/DiffieHellman.php b/Auth/OpenID/DiffieHellman.php
index b44769f..f34ab3c 100644
--- a/Net/OpenID/DiffieHellman.php
+++ b/Auth/OpenID/DiffieHellman.php
@@ -14,26 +14,26 @@
*/
/**
- * Require CryptUtil because we need to get a Net_OpenID_MathWrapper
+ * Require CryptUtil because we need to get a Auth_OpenID_MathWrapper
* object.
*/
require_once('CryptUtil.php');
-$_Net_OpenID_DEFAULT_MOD = '155172898181473697471232257763715539915724801'.
+$_Auth_OpenID_DEFAULT_MOD = '155172898181473697471232257763715539915724801'.
'966915404479707795314057629378541917580651227423698188993727816152646631'.
'438561595825688188889951272158842675419950341258706556549803580104870537'.
'681476726513255747040765857479291291572334510643245094715007229621094194'.
'349783925984760375594985848253359305585439638443';
-$_Net_OpenID_DEFAULT_GEN = '2';
+$_Auth_OpenID_DEFAULT_GEN = '2';
/**
* The Diffie-Hellman key exchange class. This class relies on
- * Net_OpenID_MathLibrary to perform large number operations.
+ * Auth_OpenID_MathLibrary to perform large number operations.
*
* @package OpenID
*/
-class Net_OpenID_DiffieHellman {
+class Auth_OpenID_DiffieHellman {
var $mod;
var $gen;
@@ -43,41 +43,41 @@ class Net_OpenID_DiffieHellman {
function fromBase64($mod, $gen)
{
if ($mod !== null) {
- $mod = Net_OpenID_CryptUtil::base64ToLong($mod);
+ $mod = Auth_OpenID_CryptUtil::base64ToLong($mod);
}
if ($gen !== null) {
- $gen = Net_OpenID_CryptUtil::base64ToLong($gen);
+ $gen = Auth_OpenID_CryptUtil::base64ToLong($gen);
}
- return new Net_OpenID_DiffieHellman($mod, $gen);
+ return new Auth_OpenID_DiffieHellman($mod, $gen);
}
- function Net_OpenID_DiffieHellman($mod = null, $gen = null,
+ function Auth_OpenID_DiffieHellman($mod = null, $gen = null,
$private = null)
{
- global $_Net_OpenID_DEFAULT_MOD,
- $_Net_OpenID_DEFAULT_GEN;
+ global $_Auth_OpenID_DEFAULT_MOD,
+ $_Auth_OpenID_DEFAULT_GEN;
- $this->lib =& Net_OpenID_MathLibrary::getLibWrapper();
+ $this->lib =& Auth_OpenID_MathLibrary::getLibWrapper();
if (!$this->lib) {
// This should NEVER occur because even if no math
// extensions can be found, we should get an instance of
- // Net_OpenID_MathWrapper, but if there's a bug in
- // Net_OpenID_MathLibrary::getLibWrapper, it might.
+ // Auth_OpenID_MathWrapper, but if there's a bug in
+ // Auth_OpenID_MathLibrary::getLibWrapper, it might.
trigger_error("Big integer fallback implementation unavailable.",
E_USER_ERROR);
}
if ($mod === null) {
- $this->mod = $this->lib->init($_Net_OpenID_DEFAULT_MOD);
+ $this->mod = $this->lib->init($_Auth_OpenID_DEFAULT_MOD);
} else {
$this->mod = $mod;
}
if ($gen === null) {
- $this->gen = $this->lib->init($_Net_OpenID_DEFAULT_GEN);
+ $this->gen = $this->lib->init($_Auth_OpenID_DEFAULT_GEN);
} else {
$this->gen = $gen;
}
@@ -102,8 +102,8 @@ class Net_OpenID_DiffieHellman {
function xorSecret($composite, $secret)
{
$dh_shared = $this->getSharedSecret($composite);
- $sha1_dh_shared = Net_OpenID_CryptUtil::sha1(
- Net_OpenID_CryptUtil::longToBinary($dh_shared));
- return Net_OpenID_CryptUtil::strxor($secret, $sha1_dh_shared);
+ $sha1_dh_shared = Auth_OpenID_CryptUtil::sha1(
+ Auth_OpenID_CryptUtil::longToBinary($dh_shared));
+ return Auth_OpenID_CryptUtil::strxor($secret, $sha1_dh_shared);
}
}
diff --git a/Net/OpenID/HMACSHA1.php b/Auth/OpenID/HMACSHA1.php
index a1c102e..9873f9a 100644
--- a/Net/OpenID/HMACSHA1.php
+++ b/Auth/OpenID/HMACSHA1.php
@@ -23,7 +23,7 @@ if (!function_exists('sha1')) {
// XXX: include the SHA1 code from Dan Libby's OpenID library
trigger_error('No SHA1 function found', E_USER_ERROR);
} else {
- function Net_OpenID_sha1_raw($text)
+ function Auth_OpenID_sha1_raw($text)
{
$hex = sha1($text);
$raw = '';
@@ -41,17 +41,17 @@ if (!function_exists('sha1')) {
*
* @ignore
*/
-function Net_OpenID_HMACSHA1($key, $text)
+function Auth_OpenID_HMACSHA1($key, $text)
{
if (strlen($key) > SHA1_BLOCKSIZE) {
- $key = Net_OpenID_sha1_raw($key, true);
+ $key = Auth_OpenID_sha1_raw($key, true);
}
$key = str_pad($key, SHA1_BLOCKSIZE, chr(0x00));
$ipad = str_repeat(chr(0x36), SHA1_BLOCKSIZE);
$opad = str_repeat(chr(0x5c), SHA1_BLOCKSIZE);
- $hash1 = Net_OpenID_sha1_raw(($key ^ $ipad) . $text, true);
- $hmac = Net_OpenID_sha1_raw(($key ^ $opad) . $hash1, true);
+ $hash1 = Auth_OpenID_sha1_raw(($key ^ $ipad) . $text, true);
+ $hmac = Auth_OpenID_sha1_raw(($key ^ $opad) . $hash1, true);
return $hmac;
}
diff --git a/Net/OpenID/KVForm.php b/Auth/OpenID/KVForm.php
index 7107da3..1b690e5 100644
--- a/Net/OpenID/KVForm.php
+++ b/Auth/OpenID/KVForm.php
@@ -14,11 +14,11 @@
*/
/**
- * The Net_OpenID_KVForm class.
+ * The Auth_OpenID_KVForm class.
*
* @package OpenID
*/
-class Net_OpenID_KVForm {
+class Auth_OpenID_KVForm {
function arrayToKV($values)
{
if ($values === null) {
diff --git a/Net/OpenID/OIDUtil.php b/Auth/OpenID/OIDUtil.php
index 2be5eab..5a8c3b6 100644
--- a/Net/OpenID/OIDUtil.php
+++ b/Auth/OpenID/OIDUtil.php
@@ -16,14 +16,14 @@
/**
* Some constants for string checking.
*/
-$_Net_OpenID_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-$_Net_OpenID_digits = "0123456789";
-$_Net_OpenID_punct = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
+$_Auth_OpenID_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+$_Auth_OpenID_digits = "0123456789";
+$_Auth_OpenID_punct = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
/**
* Convenience function for getting array values.
*/
-function Net_OpenID_array_get($arr, $key, $fallback = null)
+function Auth_OpenID_array_get($arr, $key, $fallback = null)
{
if (is_array($arr)) {
if (array_key_exists($key, $arr)) {
@@ -32,7 +32,7 @@ function Net_OpenID_array_get($arr, $key, $fallback = null)
return $fallback;
}
} else {
- trigger_error("Net_OpenID_array_get expected " .
+ trigger_error("Auth_OpenID_array_get expected " .
"array as first parameter", E_USER_WARNING);
return false;
}
@@ -42,7 +42,7 @@ function Net_OpenID_array_get($arr, $key, $fallback = null)
/**
* Prints the specified message using trigger_error(E_USER_NOTICE).
*/
-function Net_OpenID_log($message, $unused_level = 0)
+function Auth_OpenID_log($message, $unused_level = 0)
{
trigger_error($message, E_USER_NOTICE);
}
@@ -57,7 +57,7 @@ function Net_OpenID_log($message, $unused_level = 0)
* pairs from $data into a URL query string
* (e.g. "username=bob&id=56").
*/
-function Net_OpenID_http_build_query($data)
+function Auth_OpenID_http_build_query($data)
{
$pairs = array();
foreach ($data as $key => $value) {
@@ -84,7 +84,7 @@ function Net_OpenID_http_build_query($data)
* @return string $url The original URL with the new parameters added.
*
*/
-function Net_OpenID_appendArgs($url, $args)
+function Auth_OpenID_appendArgs($url, $args)
{
if (count($args) == 0) {
@@ -111,13 +111,13 @@ function Net_OpenID_appendArgs($url, $args)
$sep = '&';
}
- return $url . $sep . Net_OpenID_http_build_query($args);
+ return $url . $sep . Auth_OpenID_http_build_query($args);
}
/**
* Converts the specified string to a base64 representation.
*/
-function Net_OpenID_toBase64($s)
+function Auth_OpenID_toBase64($s)
{
return base64_encode($s);
}
@@ -126,7 +126,7 @@ function Net_OpenID_toBase64($s)
* Returns the original string representation of the specified
* base64-encoded string.
*/
-function Net_OpenID_fromBase64($s)
+function Auth_OpenID_fromBase64($s)
{
return base64_decode($s);
}
@@ -143,7 +143,7 @@ function Net_OpenID_fromBase64($s)
* Do not escape anything that is already 7-bit safe, so we do the
* minimal transform on the identity URL
*/
-function Net_OpenID_quoteMinimal($s)
+function Auth_OpenID_quoteMinimal($s)
{
$res = array();
for ($i = 0; $i < strlen($s); $i++) {
@@ -174,7 +174,7 @@ function Net_OpenID_quoteMinimal($s)
* @return string $url The URL resulting from assembling the specified
* components.
*/
-function Net_OpenID_urlunparse($scheme, $host, $port = null, $path = '/',
+function Auth_OpenID_urlunparse($scheme, $host, $port = null, $path = '/',
$query = '', $fragment = '')
{
@@ -218,7 +218,7 @@ function Net_OpenID_urlunparse($scheme, $host, $port = null, $path = '/',
* @return mixed $new_url The URL after normalization, or null if $url
* was malformed.
*/
-function Net_OpenID_normalizeUrl($url)
+function Auth_OpenID_normalizeUrl($url)
{
if ($url === null) {
return null;
@@ -264,14 +264,14 @@ function Net_OpenID_normalizeUrl($url)
$parsed = array_merge($defaults, $parsed);
}
- $tail = array_map('Net_OpenID_quoteMinimal', array($parsed['path'],
+ $tail = array_map('Auth_OpenID_quoteMinimal', array($parsed['path'],
$parsed['query'],
$parsed['fragment']));
if ($tail[0] == '') {
$tail[0] = '/';
}
- $url = Net_OpenID_urlunparse($parsed['scheme'], $parsed['host'],
+ $url = Auth_OpenID_urlunparse($parsed['scheme'], $parsed['host'],
$parsed['port'], $tail[0], $tail[1],
$tail[2]);
diff --git a/Net/OpenID/Store/DumbStore.php b/Auth/OpenID/Store/DumbStore.php
index b3a5ba5..b7ef9c2 100644
--- a/Net/OpenID/Store/DumbStore.php
+++ b/Auth/OpenID/Store/DumbStore.php
@@ -18,7 +18,7 @@
* Import the interface for creating a new store class.
*/
require_once('Interface.php');
-require_once('Net/OpenID/CryptUtil.php');
+require_once('Auth/OpenID/CryptUtil.php');
/**
* This is a store for use in the worst case, when you have no way of
@@ -32,10 +32,10 @@ require_once('Net/OpenID/CryptUtil.php');
*
* @package OpenID
*/
-class Net_OpenID_DumbStore extends Net_OpenID_OpenIDStore {
+class Auth_OpenID_DumbStore extends Auth_OpenID_OpenIDStore {
/**
- * Creates a new Net_OpenID_DumbStore instance. For the security
+ * Creates a new Auth_OpenID_DumbStore instance. For the security
* of the tokens generated by the library, this class attempts to
* at least have a secure implementation of getAuthKey.
*
@@ -45,15 +45,15 @@ class Net_OpenID_DumbStore extends Net_OpenID_OpenIDStore {
* string as the secret phrase, which means you can make it very
* difficult to guess.
*
- * Each Net_OpenID_DumbStore instance that is created for use by
+ * Each Auth_OpenID_DumbStore instance that is created for use by
* your consumer site needs to use the same $secret_phrase.
*
* @param string secret_phrase The phrase used to create the auth
* key returned by getAuthKey
*/
- function Net_OpenID_DumbStore($secret_phrase)
+ function Auth_OpenID_DumbStore($secret_phrase)
{
- $this->auth_key = Net_OpenID_CryptUtil::sha1($secret_phrase);
+ $this->auth_key = Auth_OpenID_CryptUtil::sha1($secret_phrase);
}
/**
diff --git a/Net/OpenID/Store/FileStore.php b/Auth/OpenID/Store/FileStore.php
index 6e54e28..9505dc9 100644
--- a/Net/OpenID/Store/FileStore.php
+++ b/Auth/OpenID/Store/FileStore.php
@@ -19,9 +19,9 @@
* Require base class for creating a new interface.
*/
require_once('Interface.php');
-require_once('Net/OpenID/OIDUtil.php');
+require_once('Auth/OpenID/OIDUtil.php');
-function Net_OpenID_rmtree($dir)
+function Auth_OpenID_rmtree($dir)
{
if ($dir[strlen($dir) - 1] != DIRECTORY_SEPARATOR) {
$dir .= DIRECTORY_SEPARATOR;
@@ -32,7 +32,7 @@ function Net_OpenID_rmtree($dir)
if (!in_array($item, array('.', '..'))) {
if (is_dir($dir . $item)) {
- if (!Net_OpenID_rmtree($dir . $item)) {
+ if (!Auth_OpenID_rmtree($dir . $item)) {
return false;
}
} else if (is_file($dir . $item)) {
@@ -56,7 +56,7 @@ function Net_OpenID_rmtree($dir)
}
}
-function Net_OpenID_mkstemp($dir)
+function Auth_OpenID_mkstemp($dir)
{
foreach (range(0, 4) as $i) {
$name = tempnam($dir, "php_openid_filestore_");
@@ -68,7 +68,7 @@ function Net_OpenID_mkstemp($dir)
return false;
}
-function Net_OpenID_mkdtemp($dir)
+function Auth_OpenID_mkdtemp($dir)
{
foreach (range(0, 4) as $i) {
$name = $dir . strval(DIRECTORY_SEPARATOR) . strval(getmypid()) .
@@ -82,7 +82,7 @@ function Net_OpenID_mkdtemp($dir)
return false;
}
-function Net_OpenID_listdir($dir)
+function Auth_OpenID_listdir($dir)
{
$handle = opendir($dir);
$files = array();
@@ -94,15 +94,15 @@ function Net_OpenID_listdir($dir)
function _isFilenameSafe($char)
{
- global $_Net_OpenID_letters, $_Net_OpenID_digits;
- $_Net_OpenID_filename_allowed = $_Net_OpenID_letters .
- $_Net_OpenID_digits . ".";
- return (strpos($_Net_OpenID_filename_allowed, $char) !== false);
+ global $_Auth_OpenID_letters, $_Auth_OpenID_digits;
+ $_Auth_OpenID_filename_allowed = $_Auth_OpenID_letters .
+ $_Auth_OpenID_digits . ".";
+ return (strpos($_Auth_OpenID_filename_allowed, $char) !== false);
}
function _safe64($str)
{
- $h64 = Net_OpenID_toBase64(Net_OpenID_CryptUtil::sha1($str));
+ $h64 = Auth_OpenID_toBase64(Auth_OpenID_CryptUtil::sha1($str));
$h64 = str_replace('+', '_', $h64);
$h64 = str_replace('/', '.', $h64);
$h64 = str_replace('=', '', $h64);
@@ -165,7 +165,7 @@ function _ensureDir($dir_name)
*
* @package OpenID
*/
-class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
+class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
/**
* Initializes a new FileOpenIDStore. This initializes the nonce
@@ -175,7 +175,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
* @param string $directory This is the directory to put the store
* directories in.
*/
- function Net_OpenID_FileStore($directory)
+ function Auth_OpenID_FileStore($directory)
{
$directory = realpath($directory);
@@ -200,7 +200,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
function destroy()
{
- Net_OpenID_rmtree($this->directory);
+ Auth_OpenID_rmtree($this->directory);
$this->active = false;
}
@@ -232,7 +232,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
*/
function _mktemp()
{
- $name = Net_OpenID_mkstemp($dir = $this->temp_dir);
+ $name = Auth_OpenID_mkstemp($dir = $this->temp_dir);
$file_obj = @fopen($name, 'wb');
if ($file_obj !== false) {
return array($file_obj, $name);
@@ -278,7 +278,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
return null;
}
- $auth_key = Net_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN);
+ $auth_key = Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN);
list($file_obj, $tmp) = $this->_mktemp();
@@ -438,7 +438,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
if ($handle) {
return $this->_getAssociation($filename);
} else {
- $association_files = Net_OpenID_listdir($this->association_dir);
+ $association_files = Auth_OpenID_listdir($this->association_dir);
$matching_files = array();
// strip off the path to do the comparison
@@ -505,7 +505,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
}
$association =
- Net_OpenID_Association::deserialize('Net_OpenID_Association',
+ Auth_OpenID_Association::deserialize('Auth_OpenID_Association',
$assoc_s);
if (!$association) {
@@ -606,7 +606,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
return null;
}
- $nonces = Net_OpenID_listdir($this->nonce_dir);
+ $nonces = Auth_OpenID_listdir($this->nonce_dir);
$now = time();
// Check all nonces for expiry
@@ -623,7 +623,7 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
}
}
- $association_filenames = Net_OpenID_listdir($this->association_dir);
+ $association_filenames = Auth_OpenID_listdir($this->association_dir);
foreach ($association_filenames as $association_filename) {
$association_file = fopen($association_filename, 'rb');
@@ -634,8 +634,9 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
// Remove expired or corrupted associations
$association =
- Net_OpenID_Association::deserialize('Net_OpenID_Association',
- $assoc_s);
+ Auth_OpenID_Association::deserialize(
+ 'Auth_OpenID_Association', $assoc_s);
+
if ($association === null) {
_removeIfPresent($association_filename);
} else {
@@ -648,4 +649,4 @@ class Net_OpenID_FileStore extends Net_OpenID_OpenIDStore {
}
}
-?> \ No newline at end of file
+?>
diff --git a/Net/OpenID/Store/Interface.php b/Auth/OpenID/Store/Interface.php
index 0e5c832..0500e44 100644
--- a/Net/OpenID/Store/Interface.php
+++ b/Auth/OpenID/Store/Interface.php
@@ -22,7 +22,7 @@
* @package OpenID
* @author JanRain, Inc. <openid@janrain.com>
*/
-class Net_OpenID_OpenIDStore {
+class Auth_OpenID_OpenIDStore {
/**
* @var integer The length of the auth key that should be returned
* by the getAuthKey method.
@@ -44,7 +44,7 @@ class Net_OpenID_OpenIDStore {
*/
function storeAssociation($server_url, $association)
{
- trigger_error("Net_OpenID_OpenIDStore::storeAssociation ".
+ trigger_error("Auth_OpenID_OpenIDStore::storeAssociation ".
"not implemented", E_USER_ERROR);
}
@@ -80,7 +80,7 @@ class Net_OpenID_OpenIDStore {
*/
function getAssociation($server_url, $handle = null)
{
- trigger_error("Net_OpenID_OpenIDStore::getAssociation ".
+ trigger_error("Auth_OpenID_OpenIDStore::getAssociation ".
"not implemented", E_USER_ERROR);
}
@@ -104,7 +104,7 @@ class Net_OpenID_OpenIDStore {
*/
function removeAssociation($server_url, $handle)
{
- trigger_error("Net_OpenID_OpenIDStore::removeAssociation ".
+ trigger_error("Auth_OpenID_OpenIDStore::removeAssociation ".
"not implemented", E_USER_ERROR);
}
@@ -118,7 +118,7 @@ class Net_OpenID_OpenIDStore {
*/
function storeNonce($nonce)
{
- trigger_error("Net_OpenID_OpenIDStore::storeNonce ".
+ trigger_error("Auth_OpenID_OpenIDStore::storeNonce ".
"not implemented", E_USER_ERROR);
}
@@ -139,7 +139,7 @@ class Net_OpenID_OpenIDStore {
*/
function useNonce($nonce)
{
- trigger_error("Net_OpenID_OpenIDStore::useNonce ".
+ trigger_error("Auth_OpenID_OpenIDStore::useNonce ".
"not implemented", E_USER_ERROR);
}
@@ -155,7 +155,7 @@ class Net_OpenID_OpenIDStore {
*/
function getAuthKey()
{
- trigger_error("Net_OpenID_OpenIDStore::getAuthKey ".
+ trigger_error("Auth_OpenID_OpenIDStore::getAuthKey ".
"not implemented", E_USER_ERROR);
}
@@ -164,7 +164,7 @@ class Net_OpenID_OpenIDStore {
* store. Unlike all other methods in this class, this one
* provides a default implementation, which returns false.
*
- * In general, any custom subclass of Net_OpenID_OpenIDStore won't
+ * In general, any custom subclass of Auth_OpenID_OpenIDStore won't
* override this method, as custom subclasses are only likely to
* be created when the store is fully functional.
*
diff --git a/Net/OpenID/Store/SQLStore.php b/Auth/OpenID/Store/SQLStore.php
index 04945ed..04945ed 100644
--- a/Net/OpenID/Store/SQLStore.php
+++ b/Auth/OpenID/Store/SQLStore.php
diff --git a/Tests/Net/OpenID/Association.php b/Tests/Auth/OpenID/Association.php
index 8e547c2..d344a21 100644
--- a/Tests/Net/OpenID/Association.php
+++ b/Tests/Auth/OpenID/Association.php
@@ -14,18 +14,19 @@
*/
require_once('PHPUnit.php');
-require_once('Net/OpenID/Association.php');
+require_once('Auth/OpenID/Association.php');
-class Tests_Net_OpenID_Association extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_Association extends PHPUnit_TestCase {
function test_me()
{
$issued = time();
$lifetime = 600;
- $assoc = new Net_OpenID_Association('handle', 'secret', $issued,
+ $assoc = new Auth_OpenID_Association('handle', 'secret', $issued,
$lifetime, 'HMAC-SHA1');
$s = $assoc->serialize();
- $assoc2 = Net_OpenID_Association::deserialize('Net_OpenID_Association',
- $s);
+ $assoc2 = Auth_OpenID_Association::deserialize(
+ 'Auth_OpenID_Association', $s);
+
if ($assoc2 === null) {
$this->fail('deserialize returned null');
} else {
@@ -34,4 +35,4 @@ class Tests_Net_OpenID_Association extends PHPUnit_TestCase {
}
}
-?> \ No newline at end of file
+?>
diff --git a/Tests/Net/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php
index 5937143..955558d 100644
--- a/Tests/Net/OpenID/Consumer.php
+++ b/Tests/Auth/OpenID/Consumer.php
@@ -13,21 +13,21 @@
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*/
-require_once('Net/OpenID/CryptUtil.php');
-require_once('Net/OpenID/DiffieHellman.php');
-require_once('Net/OpenID/Store/FileStore.php');
-require_once('Net/OpenID/OIDUtil.php');
-require_once('Net/OpenID/KVForm.php');
-require_once('Net/OpenID/Consumer/Consumer.php');
-
-$_Net_OpenID_assocs = array(
+require_once('Auth/OpenID/CryptUtil.php');
+require_once('Auth/OpenID/DiffieHellman.php');
+require_once('Auth/OpenID/Store/FileStore.php');
+require_once('Auth/OpenID/OIDUtil.php');
+require_once('Auth/OpenID/KVForm.php');
+require_once('Auth/OpenID/Consumer/Consumer.php');
+
+$_Auth_OpenID_assocs = array(
array('another 20-byte key.', 'Snarky'),
array(str_repeat("\x00", 20), 'Zeros'),
);
-$_Net_OpenID_filestore_base_dir = "/tmp";
+$_Auth_OpenID_filestore_base_dir = "/tmp";
-function Net_OpenID_parse($qs)
+function Auth_OpenID_parse($qs)
{
$result = array();
$parts = explode("&", $qs);
@@ -39,22 +39,22 @@ function Net_OpenID_parse($qs)
return $result;
}
-function Net_OpenID_associate($qs, $assoc_secret, $assoc_handle)
+function Auth_OpenID_associate($qs, $assoc_secret, $assoc_handle)
{
- $query_data = Net_OpenID_parse($qs);
+ $query_data = Auth_OpenID_parse($qs);
assert((count($query_data) == 6) || (count($query_data) == 4));
assert($query_data['openid.mode'] == 'associate');
assert($query_data['openid.assoc_type'] == 'HMAC-SHA1');
assert($query_data['openid.session_type'] == 'DH-SHA1');
- $d = Net_OpenID_DiffieHellman::fromBase64(
- Net_OpenID_array_get($query_data, 'openid.dh_modulus', null),
- Net_OpenID_array_get($query_data, 'openid.dh_gen', null));
+ $d = Auth_OpenID_DiffieHellman::fromBase64(
+ Auth_OpenID_array_get($query_data, 'openid.dh_modulus', null),
+ Auth_OpenID_array_get($query_data, 'openid.dh_gen', null));
- $composite = Net_OpenID_CryptUtil::base64ToLong(
+ $composite = Auth_OpenID_CryptUtil::base64ToLong(
$query_data['openid.dh_consumer_public']);
- $enc_mac_key = Net_OpenID_CryptUtil::toBase64(
+ $enc_mac_key = Auth_OpenID_CryptUtil::toBase64(
$d->xorSecret($composite, $assoc_secret));
$reply_dict = array(
@@ -63,15 +63,15 @@ function Net_OpenID_associate($qs, $assoc_secret, $assoc_handle)
'expires_in' => '600',
'session_type' => 'DH-SHA1',
'dh_server_public' =>
- Net_OpenID_CryptUtil::longToBase64($d->public),
+ Auth_OpenID_CryptUtil::longToBase64($d->public),
'enc_mac_key' => $enc_mac_key,
);
- return Net_OpenID_KVForm::arrayToKV($reply_dict);
+ return Auth_OpenID_KVForm::arrayToKV($reply_dict);
}
-class Net_OpenID_TestFetcher {
- function Net_OpenID_TestFetcher($user_url, $user_page,
+class Auth_OpenID_TestFetcher {
+ function Auth_OpenID_TestFetcher($user_url, $user_page,
$assoc_secret, $assoc_handle)
{
$this->get_responses = array($user_url => array(200,
@@ -103,7 +103,7 @@ class Net_OpenID_TestFetcher {
function post($url, $body)
{
if (strpos($body, 'openid.mode=associate') !== false) {
- $response = Net_OpenID_associate($body, $this->assoc_secret,
+ $response = Auth_OpenID_associate($body, $this->assoc_secret,
$this->assoc_handle);
$this->num_assocs++;
return $this->response($url, $response);
@@ -113,7 +113,7 @@ class Net_OpenID_TestFetcher {
}
}
-$_Net_OpenID_user_page_pat = "<html>
+$_Auth_OpenID_user_page_pat = "<html>
<head>
<title>A user page</title>
%s
@@ -123,29 +123,29 @@ $_Net_OpenID_user_page_pat = "<html>
</body>
</html>";
-$_Net_OpenID_server_url = "http://server.example.com/";
-$_Net_OpenID_consumer_url = "http://consumer.example.com/";
+$_Auth_OpenID_server_url = "http://server.example.com/";
+$_Auth_OpenID_consumer_url = "http://consumer.example.com/";
-class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_Consumer extends PHPUnit_TestCase {
function _run(&$consumer, $user_url, $mode, $delegate_url,
&$fetcher, &$store)
{
- global $Net_OpenID_SUCCESS,
- $_Net_OpenID_consumer_url,
- $_Net_OpenID_server_url;
+ global $Auth_OpenID_SUCCESS,
+ $_Auth_OpenID_consumer_url,
+ $_Auth_OpenID_server_url;
list($status, $info) = $consumer->beginAuth($user_url);
- $this->assertEquals($status, $Net_OpenID_SUCCESS);
+ $this->assertEquals($status, $Auth_OpenID_SUCCESS);
- $return_to = $_Net_OpenID_consumer_url;
- $trust_root = $_Net_OpenID_consumer_url;
+ $return_to = $_Auth_OpenID_consumer_url;
+ $trust_root = $_Auth_OpenID_consumer_url;
$redirect_url = $consumer->constructRedirect($info, $return_to,
$trust_root);
$parsed = parse_url($redirect_url);
$qs = $parsed['query'];
- $q = Net_OpenID_parse($qs);
+ $q = Auth_OpenID_parse($qs);
$this->assertEquals($q, array(
'openid.mode' => $mode,
@@ -156,7 +156,7 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
'openid.return_to' => $return_to
));
- $this->assertEquals(strpos($redirect_url, $_Net_OpenID_server_url),
+ $this->assertEquals(strpos($redirect_url, $_Auth_OpenID_server_url),
0);
$query = array(
@@ -166,26 +166,26 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
'openid.assoc_handle'=> $fetcher->assoc_handle,
);
- $assoc = $store->getAssociation($_Net_OpenID_server_url,
+ $assoc = $store->getAssociation($_Auth_OpenID_server_url,
$fetcher->assoc_handle);
$assoc->addSignature(array('mode', 'return_to', 'identity'), $query);
list($status, $info) = $consumer->completeAuth($info->token, $query);
- $this->assertEquals($status, $Net_OpenID_SUCCESS);
+ $this->assertEquals($status, $Auth_OpenID_SUCCESS);
$this->assertEquals($info, $user_url);
}
function _test_success($user_url, $delegate_url, $links, $immediate = false)
{
- global $_Net_OpenID_filestore_base_dir,
- $_Net_OpenID_server_url,
- $_Net_OpenID_user_page_pat,
- $_Net_OpenID_assocs;
+ global $_Auth_OpenID_filestore_base_dir,
+ $_Auth_OpenID_server_url,
+ $_Auth_OpenID_user_page_pat,
+ $_Auth_OpenID_assocs;
- $store = new Net_OpenID_FileStore(
- Net_OpenID_mkdtemp($_Net_OpenID_filestore_base_dir));
+ $store = new Auth_OpenID_FileStore(
+ Auth_OpenID_mkdtemp($_Auth_OpenID_filestore_base_dir));
if ($immediate) {
$mode = 'checkid_immediate';
@@ -193,12 +193,12 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
$mode = 'checkid_setup';
}
- $user_page = sprintf($_Net_OpenID_user_page_pat, $links);
- $fetcher = new Net_OpenID_TestFetcher($user_url, $user_page,
- $_Net_OpenID_assocs[0][0],
- $_Net_OpenID_assocs[0][1]);
+ $user_page = sprintf($_Auth_OpenID_user_page_pat, $links);
+ $fetcher = new Auth_OpenID_TestFetcher($user_url, $user_page,
+ $_Auth_OpenID_assocs[0][0],
+ $_Auth_OpenID_assocs[0][1]);
- $consumer = new Net_OpenID_Consumer($store, &$fetcher, $immediate);
+ $consumer = new Auth_OpenID_Consumer($store, &$fetcher, $immediate);
$this->assertEquals($fetcher->num_assocs, 0);
$this->_run($consumer, $user_url, $mode, $delegate_url,
@@ -213,7 +213,7 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
$this->assertEquals($fetcher->num_assocs, 1);
// Another association is created if we remove the existing one
- $store->removeAssociation($_Net_OpenID_server_url,
+ $store->removeAssociation($_Auth_OpenID_server_url,
$fetcher->assoc_handle);
$this->_run($consumer, $user_url, $mode, $delegate_url,
@@ -232,16 +232,16 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
function test_success()
{
- global $_Net_OpenID_server_url;
+ global $_Auth_OpenID_server_url;
$user_url = 'http://www.example.com/user.html';
$links = sprintf('<link rel="openid.server" href="%s" />',
- $_Net_OpenID_server_url);
+ $_Auth_OpenID_server_url);
$delegate_url = 'http://consumer.example.com/user';
$delegate_links = sprintf('<link rel="openid.server" href="%s" />'.
'<link rel="openid.delegate" href="%s" />',
- $_Net_OpenID_server_url, $delegate_url);
+ $_Auth_OpenID_server_url, $delegate_url);
$this->_test_success($user_url, $user_url, $links);
$this->_test_success($user_url, $user_url, $links, true);
@@ -251,14 +251,14 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
function test_bad_fetch()
{
- global $_Net_OpenID_filestore_base_dir,
- $Net_OpenID_HTTP_FAILURE;
+ global $_Auth_OpenID_filestore_base_dir,
+ $Auth_OpenID_HTTP_FAILURE;
- $store = new Net_OpenID_FileStore(
- Net_OpenID_mkdtemp($_Net_OpenID_filestore_base_dir));
+ $store = new Auth_OpenID_FileStore(
+ Auth_OpenID_mkdtemp($_Auth_OpenID_filestore_base_dir));
- $fetcher = new Net_OpenID_TestFetcher(null, null, null, null);
- $consumer = new Net_OpenID_Consumer($store, &$fetcher);
+ $fetcher = new Auth_OpenID_TestFetcher(null, null, null, null);
+ $consumer = new Auth_OpenID_Consumer($store, &$fetcher);
$cases = array(
array(null, 'http://network.error/'),
array(404, 'http://not.found/'),
@@ -270,7 +270,7 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
list($error_code, $url) = $case;
$fetcher->get_responses[$url] = array($error_code, $url, null);
list($status, $info) = $consumer->beginAuth($url);
- $this->assertEquals($status, $Net_OpenID_HTTP_FAILURE);
+ $this->assertEquals($status, $Auth_OpenID_HTTP_FAILURE);
$this->assertEquals($info, $error_code);
}
@@ -279,11 +279,11 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
function test_bad_parse()
{
- global $_Net_OpenID_filestore_base_dir,
- $Net_OpenID_PARSE_ERROR;
+ global $_Auth_OpenID_filestore_base_dir,
+ $Auth_OpenID_PARSE_ERROR;
- $store = new Net_OpenID_FileStore(
- Net_OpenID_mkdtemp($_Net_OpenID_filestore_base_dir));
+ $store = new Auth_OpenID_FileStore(
+ Auth_OpenID_mkdtemp($_Auth_OpenID_filestore_base_dir));
$user_url = 'http://user.example.com/';
$cases = array(
@@ -293,11 +293,11 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase {
);
foreach ($cases as $user_page) {
- $fetcher = new Net_OpenID_TestFetcher($user_url, $user_page,
+ $fetcher = new Auth_OpenID_TestFetcher($user_url, $user_page,
null, null);
- $consumer = new Net_OpenID_Consumer($store, $fetcher);
+ $consumer = new Auth_OpenID_Consumer($store, $fetcher);
list($status, $info) = $consumer->beginAuth($user_url);
- $this->assertEquals($status, $Net_OpenID_PARSE_ERROR);
+ $this->assertEquals($status, $Auth_OpenID_PARSE_ERROR);
$this->assertNull($info);
}
diff --git a/Tests/Net/OpenID/CryptUtil.php b/Tests/Auth/OpenID/CryptUtil.php
index 33e500a..cb8dba1 100644
--- a/Tests/Net/OpenID/CryptUtil.php
+++ b/Tests/Auth/OpenID/CryptUtil.php
@@ -14,14 +14,14 @@
*/
require_once('PHPUnit.php');
-require_once('Net/OpenID/CryptUtil.php');
+require_once('Auth/OpenID/CryptUtil.php');
-class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_ByteOps extends PHPUnit_TestCase {
function test_length()
{
$cases = array(1, 10, 255);
foreach ($cases as $length) {
- $data = Net_OpenID_CryptUtil::getBytes($length);
+ $data = Auth_OpenID_CryptUtil::getBytes($length);
$this->assertEquals(strlen($data), $length);
}
}
@@ -31,10 +31,10 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase {
$num_iterations = 100;
$data_length = 20;
- $data = Net_OpenID_CryptUtil::getBytes($num_iterations);
+ $data = Auth_OpenID_CryptUtil::getBytes($num_iterations);
for ($i = 0; $i < $num_iterations; $i++) {
$last = $data;
- $data = Net_OpenID_CryptUtil::getBytes($num_iterations);
+ $data = Auth_OpenID_CryptUtil::getBytes($num_iterations);
$this->assertFalse($data == $last);
}
}
@@ -44,8 +44,8 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase {
// It's possible, but HIGHLY unlikely that a correct
// implementation will fail by returning the same number twice
- $s = Net_OpenID_CryptUtil::getBytes(32);
- $t = Net_OpenID_CryptUtil::getBytes(32);
+ $s = Auth_OpenID_CryptUtil::getBytes(32);
+ $t = Auth_OpenID_CryptUtil::getBytes(32);
$this->assertEquals(strlen($s), 32);
$this->assertEquals(strlen($t), 32);
$this->assertFalse($s == $t);
@@ -71,7 +71,7 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase {
while (list($index, $values) = each($cases)) {
list($aa, $bb, $expected) = $values;
- $actual = Net_OpenID_CryptUtil::strxor($aa, $bb);
+ $actual = Auth_OpenID_CryptUtil::strxor($aa, $bb);
$this->assertEquals($actual, $expected);
}
@@ -88,7 +88,7 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase {
while(list($index, $values) = each($exc_cases)) {
list($aa, $bb) = $values;
- $unexpected = Net_OpenID_CryptUtil::strxor($aa, $bb);
+ $unexpected = Auth_OpenID_CryptUtil::strxor($aa, $bb);
$this->assertNull($unexpected);
}
}
@@ -110,19 +110,19 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase {
while (list($index, $values) = each($cases)) {
list($case, $expected) = $values;
- $actual = Net_OpenID_CryptUtil::reversed($case);
+ $actual = Auth_OpenID_CryptUtil::reversed($case);
$this->assertEquals($actual, $expected);
- $twice = Net_OpenID_CryptUtil::reversed($actual);
+ $twice = Auth_OpenID_CryptUtil::reversed($actual);
$this->assertEquals($twice, $case);
}
}
}
-class Tests_Net_OpenID_BinLongConvertRnd extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_BinLongConvertRnd extends PHPUnit_TestCase {
var $lib;
var $max;
- function Tests_Net_OpenID_BinLongConvertRnd(&$lib, $max)
+ function Tests_Auth_OpenID_BinLongConvertRnd(&$lib, $max)
{
$this->lib =& $lib;
$this->max = $max;
@@ -132,22 +132,22 @@ class Tests_Net_OpenID_BinLongConvertRnd extends PHPUnit_TestCase {
{
$n = $this->lib->init(0);
foreach (range(0, 9) as $i) {
- $rnd = Net_OpenID_CryptUtil::randrange($this->max);
+ $rnd = Auth_OpenID_CryptUtil::randrange($this->max);
$n = $this->lib->add($n, $rnd);
}
- $s = Net_OpenID_CryptUtil::longToBinary($n);
+ $s = Auth_OpenID_CryptUtil::longToBinary($n);
$this->assertTrue(is_string($s));
- $n_prime = Net_OpenID_CryptUtil::binaryToLong($s);
+ $n_prime = Auth_OpenID_CryptUtil::binaryToLong($s);
$this->assertEquals($this->lib->cmp($n, $n_prime), 0);
}
}
-class Tests_Net_OpenID_BinLongConvert extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_BinLongConvert extends PHPUnit_TestCase {
var $lib;
var $bin;
var $lng;
- function Tests_Net_OpenID_BinLongConvert(&$lib, $bin, $lng)
+ function Tests_Auth_OpenID_BinLongConvert(&$lib, $bin, $lng)
{
$this->lib =& $lib;
$this->bin = $bin;
@@ -156,19 +156,19 @@ class Tests_Net_OpenID_BinLongConvert extends PHPUnit_TestCase {
function runTest()
{
- $n_prime = Net_OpenID_CryptUtil::binaryToLong($this->bin);
- $s_prime = Net_OpenID_CryptUtil::longToBinary($this->lng);
+ $n_prime = Auth_OpenID_CryptUtil::binaryToLong($this->bin);
+ $s_prime = Auth_OpenID_CryptUtil::longToBinary($this->lng);
$this->assertEquals($this->lib->cmp($this->lng, $n_prime), 0);
$this->assertTrue($this->bin == $s_prime);
}
}
-class Tests_Net_OpenID_Base64ToLong extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_Base64ToLong extends PHPUnit_TestCase {
var $num;
var $b64;
var $lib;
- function Tests_Net_OpenID_Base64ToLong(&$lib, $b64, $num)
+ function Tests_Auth_OpenID_Base64ToLong(&$lib, $b64, $num)
{
$this->lib = $lib;
$this->b64 = $b64;
@@ -177,13 +177,13 @@ class Tests_Net_OpenID_Base64ToLong extends PHPUnit_TestCase {
function runTest()
{
- $actual = Net_OpenID_CryptUtil::base64ToLong($this->b64);
+ $actual = Auth_OpenID_CryptUtil::base64ToLong($this->b64);
$this->assertTrue($this->lib->cmp($this->num, $actual) == 0);
}
}
-class Tests_Net_OpenID_LongToBase64 extends Tests_Net_OpenID_Base64ToLong {
- function Tests_Net_OpenID_LongToBase64(&$lib, $b64, $num)
+class Tests_Auth_OpenID_LongToBase64 extends Tests_Auth_OpenID_Base64ToLong {
+ function Tests_Auth_OpenID_LongToBase64(&$lib, $b64, $num)
{
$this->lib = $lib;
$this->b64 = $b64;
@@ -192,13 +192,13 @@ class Tests_Net_OpenID_LongToBase64 extends Tests_Net_OpenID_Base64ToLong {
function runTest()
{
- $actual = Net_OpenID_CryptUtil::longToBase64($this->num);
+ $actual = Auth_OpenID_CryptUtil::longToBase64($this->num);
$this->assertEquals($this->b64, $actual);
}
}
-class Tests_Net_OpenID_RandRange extends PHPUnit_TestCase {
- function Tests_Net_OpenID_RandRange(&$lib)
+class Tests_Auth_OpenID_RandRange extends PHPUnit_TestCase {
+ function Tests_Auth_OpenID_RandRange(&$lib)
{
$this->lib =& $lib;
}
@@ -206,23 +206,23 @@ class Tests_Net_OpenID_RandRange extends PHPUnit_TestCase {
function runTest()
{
$stop = $this->lib->pow(2, 128);
- $a = Net_OpenID_CryptUtil::randrange($stop);
- $b = Net_OpenID_CryptUtil::randrange($stop);
+ $a = Auth_OpenID_CryptUtil::randrange($stop);
+ $b = Auth_OpenID_CryptUtil::randrange($stop);
$this->assertFalse($this->lib->cmp($b, $a) == 0, "Same: $a $b");
- $n = $this->lib->init(Net_OpenID_CryptUtil::maxint());
+ $n = $this->lib->init(Auth_OpenID_CryptUtil::maxint());
$n = $this->lib->add($n, 1);
// Make sure that we can generate random numbers that are
// larger than platform int size
- $result = Net_OpenID_CryptUtil::randrange($n);
+ $result = Auth_OpenID_CryptUtil::randrange($n);
// What can we say about the result?
}
}
-class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite {
+class Tests_Auth_OpenID_CryptUtil extends PHPUnit_TestSuite {
function _parseBase64Data()
{
$lines = file_get_contents('Tests/n2b64', true);
@@ -239,19 +239,19 @@ class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite {
return $data;
}
- function Tests_Net_OpenID_CryptUtil($name)
+ function Tests_Auth_OpenID_CryptUtil($name)
{
$this->setName($name);
- if (!defined('Net_OpenID_NO_MATH_SUPPORT')) {
- $this->addTestSuite('Tests_Net_OpenID_BigInt');
+ if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
+ $this->addTestSuite('Tests_Auth_OpenID_BigInt');
- $lib =& Net_OpenID_MathLibrary::getLibWrapper();
- $max = Net_OpenID_CryptUtil::maxint();
- $upper = defined('Tests_Net_OpenID_thorough') ? 499 : 3;
+ $lib =& Auth_OpenID_MathLibrary::getLibWrapper();
+ $max = Auth_OpenID_CryptUtil::maxint();
+ $upper = defined('Tests_Auth_OpenID_thorough') ? 499 : 3;
foreach (range(0, $upper) as $iteration) {
- $test = new Tests_Net_OpenID_BinLongConvertRnd($lib, $max);
+ $test = new Tests_Auth_OpenID_BinLongConvertRnd($lib, $max);
$test->setName("BinLongConvertRnd " . strval($iteration));
$this->addTest($test);
}
@@ -268,12 +268,12 @@ class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite {
foreach ($cases as $bin => $lng_m) {
$lng = $lib->init($lng_m);
- $test = new Tests_Net_OpenID_BinLongConvert($lib, $bin, $lng);
+ $test = new Tests_Auth_OpenID_BinLongConvert($lib, $bin, $lng);
$test->setName('BinLongConvert ' . bin2hex($bin));
$this->addTest($test);
}
- $count = defined('Tests_Net_OpenID_thorough') ? -1 : 2;
+ $count = defined('Tests_Auth_OpenID_thorough') ? -1 : 2;
$data = $this->_parseBase64Data();
foreach ($data as $b64 => $num_s) {
// Only test the first few unless thorough is defined
@@ -285,21 +285,21 @@ class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite {
}
}
$num = $lib->init($num_s);
- $test = new Tests_Net_OpenID_Base64ToLong($lib, $b64, $num);
+ $test = new Tests_Auth_OpenID_Base64ToLong($lib, $b64, $num);
$test->setName("B64->Long $num_s");
$this->addTest($test);
- $test = new Tests_Net_OpenID_LongToBase64($lib, $b64, $num);
+ $test = new Tests_Auth_OpenID_LongToBase64($lib, $b64, $num);
$test->setName("Long->B64 $num_s");
$this->addTest($test);
}
- $test = new Tests_Net_OpenID_RandRange($lib);
+ $test = new Tests_Auth_OpenID_RandRange($lib);
$test->setName('Big number randrange');
$this->addTest($test);
}
- $this->addTestSuite('Tests_Net_OpenID_ByteOps');
+ $this->addTestSuite('Tests_Auth_OpenID_ByteOps');
}
}
diff --git a/Tests/Net/OpenID/DiffieHellman.php b/Tests/Auth/OpenID/DiffieHellman.php
index 043ef85..9f6cd1a 100644
--- a/Tests/Net/OpenID/DiffieHellman.php
+++ b/Tests/Auth/OpenID/DiffieHellman.php
@@ -15,10 +15,10 @@
*/
require_once('PHPUnit.php');
-require_once('Net/OpenID/DiffieHellman.php');
+require_once('Auth/OpenID/DiffieHellman.php');
-class Tests_Net_OpenID_DiffieHellman_CheckCases extends PHPUnit_TestCase {
- function Tests_Net_OpenID_DiffieHellman_CheckCases($cases, $n)
+class Tests_Auth_OpenID_DiffieHellman_CheckCases extends PHPUnit_TestCase {
+ function Tests_Auth_OpenID_DiffieHellman_CheckCases($cases, $n)
{
$this->cases = $cases;
$this->n = $n;
@@ -30,8 +30,8 @@ class Tests_Net_OpenID_DiffieHellman_CheckCases extends PHPUnit_TestCase {
}
}
-class Tests_Net_OpenID_DiffieHellman_Private extends PHPUnit_TestCase {
- function Tests_Net_OpenID_DiffieHellman_Private($name, $input, $expected)
+class Tests_Auth_OpenID_DiffieHellman_Private extends PHPUnit_TestCase {
+ function Tests_Auth_OpenID_DiffieHellman_Private($name, $input, $expected)
{
$this->setName("$name");
$this->input = $input;
@@ -40,13 +40,13 @@ class Tests_Net_OpenID_DiffieHellman_Private extends PHPUnit_TestCase {
function runTest()
{
- $dh = new Net_OpenID_DiffieHellman(null, null, $this->input);
+ $dh = new Auth_OpenID_DiffieHellman(null, null, $this->input);
$this->assertEquals($this->expected, $dh->getPublicKey());
}
}
-class Tests_Net_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase {
- function Tests_Net_OpenID_DiffieHellman_Exch($name, $p1, $p2, $shared)
+class Tests_Auth_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase {
+ function Tests_Auth_OpenID_DiffieHellman_Exch($name, $p1, $p2, $shared)
{
$this->setName("$name");
$this->p1 = $p1;
@@ -56,10 +56,10 @@ class Tests_Net_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase {
function runTest()
{
- $lib =& Net_OpenID_MathLibrary::getLibWrapper();
+ $lib =& Auth_OpenID_MathLibrary::getLibWrapper();
$shared = $lib->init($this->shared);
- $dh1 = new Net_OpenID_DiffieHellman(null, null, $this->p1);
- $dh2 = new Net_OpenID_DiffieHellman(null, null, $this->p2);
+ $dh1 = new Auth_OpenID_DiffieHellman(null, null, $this->p1);
+ $dh2 = new Auth_OpenID_DiffieHellman(null, null, $this->p2);
$sh1 = $dh1->getSharedSecret($dh2->getPublicKey());
$sh2 = $dh2->getSharedSecret($dh1->getPublicKey());
$this->assertEquals($lib->cmp($shared, $sh1), 0);
@@ -67,7 +67,7 @@ class Tests_Net_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase {
}
}
-class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite {
+class Tests_Auth_OpenID_DiffieHellman extends PHPUnit_TestSuite {
function _getLines($base)
{
$path = dirname(realpath(__FILE__));
@@ -82,7 +82,7 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite {
function _readPrivateTestCases()
{
- $lines = Tests_Net_OpenID_DiffieHellman::_getLines('dhpriv');
+ $lines = Tests_Auth_OpenID_DiffieHellman::_getLines('dhpriv');
$cases = array();
foreach ($lines as $line) {
$case = array();
@@ -105,7 +105,7 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite {
function _readExchTestCases()
{
- $lines = Tests_Net_OpenID_DiffieHellman::_getLines('dhexch');
+ $lines = Tests_Auth_OpenID_DiffieHellman::_getLines('dhexch');
$cases = array();
foreach ($lines as $line) {
$case = array();
@@ -125,24 +125,24 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite {
return $cases;
}
- function Tests_Net_OpenID_DiffieHellman($name)
+ function Tests_Auth_OpenID_DiffieHellman($name)
{
$this->setName($name);
- $priv_cases = Tests_Net_OpenID_DiffieHellman::_readPrivateTestCases();
- $sanity = new Tests_Net_OpenID_DiffieHellman_CheckCases(
+ $priv_cases = Tests_Auth_OpenID_DiffieHellman::_readPrivateTestCases();
+ $sanity = new Tests_Auth_OpenID_DiffieHellman_CheckCases(
$priv_cases, 29);
$sanity->setName('Check parsing of priv test data');
$this->addTest($sanity);
- $exch_cases = Tests_Net_OpenID_DiffieHellman::_readExchTestCases();
- $sanity = new Tests_Net_OpenID_DiffieHellman_CheckCases(
+ $exch_cases = Tests_Auth_OpenID_DiffieHellman::_readExchTestCases();
+ $sanity = new Tests_Auth_OpenID_DiffieHellman_CheckCases(
$exch_cases, 25);
$sanity->setName('Check parsing of exch test data');
$this->addTest($sanity);
- if (!defined('Net_OpenID_NO_MATH_SUPPORT')) {
- if (defined('Tests_Net_OpenID_thorough')) {
+ if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
+ if (defined('Tests_Auth_OpenID_thorough')) {
$npriv = count($priv_cases);
$nexch = count($exch_cases);
} else {
@@ -152,14 +152,14 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite {
for ($i = 0; $i < $npriv; $i++) {
$case = $priv_cases[$i];
- $one = new Tests_Net_OpenID_DiffieHellman_Private(
+ $one = new Tests_Auth_OpenID_DiffieHellman_Private(
$i, $case[0], $case[1]);
$this->addTest($one);
}
for ($i = 0; $i < $nexch; $i++) {
$case = $exch_cases[$i];
- $one = new Tests_Net_OpenID_DiffieHellman_Exch(
+ $one = new Tests_Auth_OpenID_DiffieHellman_Exch(
$i, $case[0], $case[1], $case[2]);
$this->addTest($one);
}
diff --git a/Tests/Net/OpenID/HMACSHA1.php b/Tests/Auth/OpenID/HMACSHA1.php
index a184078..00b6b6c 100644
--- a/Tests/Net/OpenID/HMACSHA1.php
+++ b/Tests/Auth/OpenID/HMACSHA1.php
@@ -15,10 +15,10 @@
*/
require_once('PHPUnit.php');
-require_once('Net/OpenID/HMACSHA1.php');
+require_once('Auth/OpenID/HMACSHA1.php');
-class Tests_Net_OpenID_HMACSHA1_TestCase extends PHPUnit_TestCase {
- function Tests_Net_OpenID_HMACSHA1_TestCase(
+class Tests_Auth_OpenID_HMACSHA1_TestCase extends PHPUnit_TestCase {
+ function Tests_Auth_OpenID_HMACSHA1_TestCase(
$name, $key, $data, $expected)
{
@@ -30,12 +30,12 @@ class Tests_Net_OpenID_HMACSHA1_TestCase extends PHPUnit_TestCase {
function runTest()
{
- $actual = Net_OpenID_HMACSHA1($this->key, $this->data);
+ $actual = Auth_OpenID_HMACSHA1($this->key, $this->data);
$this->assertEquals($this->expected, $actual);
}
}
-class Tests_Net_OpenID_HMACSHA1 extends PHPUnit_TestSuite {
+class Tests_Auth_OpenID_HMACSHA1 extends PHPUnit_TestSuite {
function _strConvert($s)
{
$repeat_pat = '/^0x([a-f0-9]{2}) repeated (\d+) times$/';
@@ -109,19 +109,19 @@ class Tests_Net_OpenID_HMACSHA1 extends PHPUnit_TestSuite {
foreach ($cases as $case) {
$clean = array();
$clean["key"] =
- Tests_Net_OpenID_HMACSHA1::_strConvert($case["key"]);
+ Tests_Auth_OpenID_HMACSHA1::_strConvert($case["key"]);
if (strlen($clean["key"]) != $case["key_len"]) {
trigger_error("Bad key length", E_USER_ERROR);
}
$clean["data"] =
- Tests_Net_OpenID_HMACSHA1::_strConvert($case["data"]);
+ Tests_Auth_OpenID_HMACSHA1::_strConvert($case["data"]);
if (strlen($clean["data"]) != $case["data_len"]) {
trigger_error("Bad data length", E_USER_ERROR);
}
$clean["digest"] =
- Tests_Net_OpenID_HMACSHA1::_strConvert($case["digest"]);
+ Tests_Auth_OpenID_HMACSHA1::_strConvert($case["digest"]);
if (strlen($clean["digest"]) != 20) {
$l = strlen($clean["digest"]);
trigger_error("Bad digest length: $l", E_USER_ERROR);
@@ -134,12 +134,12 @@ class Tests_Net_OpenID_HMACSHA1 extends PHPUnit_TestSuite {
return $final;
}
- function Tests_Net_OpenID_HMACSHA1($name)
+ function Tests_Auth_OpenID_HMACSHA1($name)
{
$this->setName($name);
$cases = $this->_readTestCases();
foreach ($cases as $case) {
- $test = new Tests_Net_OpenID_HMACSHA1_TestCase(
+ $test = new Tests_Auth_OpenID_HMACSHA1_TestCase(
$case['test_case'],
$case['key'],
$case['data'],
diff --git a/Tests/Net/OpenID/KVForm.php b/Tests/Auth/OpenID/KVForm.php
index eb14849..f103c18 100644
--- a/Tests/Net/OpenID/KVForm.php
+++ b/Tests/Auth/OpenID/KVForm.php
@@ -14,34 +14,34 @@
*/
require_once('PHPUnit.php');
-require_once('Net/OpenID/KVForm.php');
+require_once('Auth/OpenID/KVForm.php');
-$_Tests_Net_OpenID_kverrors = null;
+$_Tests_Auth_OpenID_kverrors = null;
/**
* Keep a list of the logged errors
*/
-function Tests_Net_OpenID_kvHandleError($errno, $errmsg)
+function Tests_Auth_OpenID_kvHandleError($errno, $errmsg)
{
- global $_Tests_Net_OpenID_kverrors;
- $_Tests_Net_OpenID_kverrors[] = $errmsg;
+ global $_Tests_Auth_OpenID_kverrors;
+ $_Tests_Auth_OpenID_kverrors[] = $errmsg;
}
-class Tests_Net_OpenID_KVForm_TestCase extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_KVForm_TestCase extends PHPUnit_TestCase {
var $errs;
function runTest()
{
// Re-set the number of logged errors
- global $_Tests_Net_OpenID_kverrors;
- $_Tests_Net_OpenID_kverrors = array();
+ global $_Tests_Auth_OpenID_kverrors;
+ $_Tests_Auth_OpenID_kverrors = array();
- set_error_handler("Tests_Net_OpenID_kvHandleError");
+ set_error_handler("Tests_Auth_OpenID_kvHandleError");
$this->_runTest();
// Check to make sure we have the expected number of logged errors
- //$this->assertEquals($this->errs, count($_Tests_Net_OpenID_kverrors));
+ //$this->assertEquals($this->errs, count($_Tests_Auth_OpenID_kverrors));
restore_error_handler();
}
@@ -52,9 +52,9 @@ class Tests_Net_OpenID_KVForm_TestCase extends PHPUnit_TestCase {
}
}
-class Tests_Net_OpenID_KVForm_TestCase_Parse
-extends Tests_Net_OpenID_KVForm_TestCase {
- function Tests_Net_OpenID_KVForm_TestCase_Parse(
+class Tests_Auth_OpenID_KVForm_TestCase_Parse
+extends Tests_Auth_OpenID_KVForm_TestCase {
+ function Tests_Auth_OpenID_KVForm_TestCase_Parse(
$arr, $str, $lossy, $errs)
{
@@ -68,8 +68,8 @@ extends Tests_Net_OpenID_KVForm_TestCase {
{
// Do one parse, after which arrayToKV and kvToArray should be
// inverses.
- $parsed1 = Net_OpenID_KVForm::kvToArray($this->str);
- $serial1 = Net_OpenID_KVForm::arrayToKV($this->arr);
+ $parsed1 = Auth_OpenID_KVForm::kvToArray($this->str);
+ $serial1 = Auth_OpenID_KVForm::arrayToKV($this->arr);
if ($this->lossy == "neither" || $this->lossy == "str") {
$this->assertEquals($this->arr, $parsed1, "str was lossy");
@@ -79,12 +79,12 @@ extends Tests_Net_OpenID_KVForm_TestCase {
$this->assertEquals($this->str, $serial1, "array was lossy");
}
- $parsed2 = Net_OpenID_KVForm::kvToArray($serial1);
- $serial2 = Net_OpenID_KVForm::arrayToKV($parsed1);
+ $parsed2 = Auth_OpenID_KVForm::kvToArray($serial1);
+ $serial2 = Auth_OpenID_KVForm::arrayToKV($parsed1);
// Round-trip both
- $parsed3 = Net_OpenID_KVForm::kvToArray($serial2);
- $serial3 = Net_OpenID_KVForm::arrayToKV($parsed2);
+ $parsed3 = Auth_OpenID_KVForm::kvToArray($serial2);
+ $serial3 = Auth_OpenID_KVForm::arrayToKV($parsed2);
$this->assertEquals($serial2, $serial3, "serialized forms differ");
@@ -94,9 +94,9 @@ extends Tests_Net_OpenID_KVForm_TestCase {
}
}
-class Tests_Net_OpenID_KVForm_TestCase_Null
-extends Tests_Net_OpenID_KVForm_TestCase {
- function Tests_Net_OpenID_KVForm_TestCase_Null($arr, $errs)
+class Tests_Auth_OpenID_KVForm_TestCase_Null
+extends Tests_Auth_OpenID_KVForm_TestCase {
+ function Tests_Auth_OpenID_KVForm_TestCase_Null($arr, $errs)
{
$this->arr = $arr;
$this->errs = $errs;
@@ -104,14 +104,14 @@ extends Tests_Net_OpenID_KVForm_TestCase {
function _runTest()
{
- $serialized = Net_OpenID_KVForm::arrayToKV($this->arr);
+ $serialized = Auth_OpenID_KVForm::arrayToKV($this->arr);
$this->assertTrue($serialized === null,
'serialization unexpectedly succeeded');
}
}
-class Tests_Net_OpenID_KVForm extends PHPUnit_TestSuite {
- function Tests_Net_OpenID_KVForm($name)
+class Tests_Auth_OpenID_KVForm extends PHPUnit_TestSuite {
+ function Tests_Auth_OpenID_KVForm($name)
{
$this->setName($name);
$testdata_list = array(
@@ -240,14 +240,14 @@ class Tests_Net_OpenID_KVForm extends PHPUnit_TestSuite {
}
if (is_null($str)) {
- $test = new Tests_Net_OpenID_KVForm_TestCase_Null($arr, $errs);
+ $test = new Tests_Auth_OpenID_KVForm_TestCase_Null($arr, $errs);
} else {
if (isset($testdata['lossy'])) {
$lossy = $testdata["lossy"];
} else {
$lossy = 'neither';
}
- $test = new Tests_Net_OpenID_KVForm_TestCase(
+ $test = new Tests_Auth_OpenID_KVForm_TestCase(
$arr, $str, $lossy, $errs);
}
$test->setName($testdata["name"]);
diff --git a/Tests/Net/OpenID/OIDUtil.php b/Tests/Auth/OpenID/OIDUtil.php
index af29fe0..f692eb4 100644
--- a/Tests/Net/OpenID/OIDUtil.php
+++ b/Tests/Auth/OpenID/OIDUtil.php
@@ -14,9 +14,9 @@
*/
require_once('PHPUnit.php');
-require_once('Net/OpenID/OIDUtil.php');
+require_once('Auth/OpenID/OIDUtil.php');
-class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_OIDUtil extends PHPUnit_TestCase {
function test_base64()
{
// This is not good for international use, but PHP doesn't
@@ -50,9 +50,9 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase {
);
foreach ($cases as $s) {
- $b64 = Net_OpenID_toBase64($s);
+ $b64 = Auth_OpenID_toBase64($s);
checkEncoded($this, $b64, $allowed_d);
- $s_prime = Net_OpenID_fromBase64($b64);
+ $s_prime = Auth_OpenID_fromBase64($b64);
$this->assertEquals($s_prime, $s);
}
@@ -67,9 +67,9 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase {
$s = implode("", array_map('chr',
array_map('random_ordinal',
range(0, $n))));
- $b64 = Net_OpenID_toBase64($s);
+ $b64 = Auth_OpenID_toBase64($s);
checkEncoded($this, $b64, $allowed_d);
- $s_prime = Net_OpenID_fromBase64($b64);
+ $s_prime = Auth_OpenID_fromBase64($b64);
$this->assertEquals($s_prime, $s);
}
}
@@ -77,35 +77,35 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase {
function test_normalizeUrl()
{
$this->assertEquals("http://foo.com/",
- Net_OpenID_normalizeUrl("foo.com"));
+ Auth_OpenID_normalizeUrl("foo.com"));
$this->assertEquals("http://foo.com/",
- Net_OpenID_normalizeUrl("http://foo.com"));
+ Auth_OpenID_normalizeUrl("http://foo.com"));
$this->assertEquals("https://foo.com/",
- Net_OpenID_normalizeUrl("https://foo.com"));
+ Auth_OpenID_normalizeUrl("https://foo.com"));
$this->assertEquals("http://foo.com/bar",
- Net_OpenID_normalizeUrl("foo.com/bar"));
+ Auth_OpenID_normalizeUrl("foo.com/bar"));
$this->assertEquals("http://foo.com/bar",
- Net_OpenID_normalizeUrl("http://foo.com/bar"));
+ Auth_OpenID_normalizeUrl("http://foo.com/bar"));
$this->assertEquals("http://foo.com/",
- Net_OpenID_normalizeUrl("http://foo.com/"));
+ Auth_OpenID_normalizeUrl("http://foo.com/"));
$this->assertEquals("https://foo.com/",
- Net_OpenID_normalizeUrl("https://foo.com/"));
+ Auth_OpenID_normalizeUrl("https://foo.com/"));
$this->assertEquals("https://foo.com/bar" ,
- Net_OpenID_normalizeUrl("https://foo.com/bar"));
+ Auth_OpenID_normalizeUrl("https://foo.com/bar"));
if (0) {
$this->assertEquals("http://foo.com/%E8%8D%89",
- Net_OpenID_normalizeUrl("foo.com/\u8349"));
+ Auth_OpenID_normalizeUrl("foo.com/\u8349"));
$this->assertEquals("http://foo.com/%E8%8D%89",
- Net_OpenID_normalizeUrl("http://foo.com/\u8349"));
+ Auth_OpenID_normalizeUrl("http://foo.com/\u8349"));
}
$non_ascii_domain_cases = array(
@@ -140,16 +140,16 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase {
for expected, case in non_ascii_domain_cases:
try:
-actual = Net_OpenID_normalizeUrl(case)
+actual = Auth_OpenID_normalizeUrl(case)
except UnicodeError:
assert should_raise
else:
assert not should_raise and actual == expected, case
*/
- $this->assertNull(Net_OpenID_normalizeUrl(null));
- $this->assertNull(Net_OpenID_normalizeUrl(''));
- $this->assertNull(Net_OpenID_normalizeUrl('http://'));
+ $this->assertNull(Auth_OpenID_normalizeUrl(null));
+ $this->assertNull(Auth_OpenID_normalizeUrl(''));
+ $this->assertNull(Auth_OpenID_normalizeUrl('http://'));
}
function test_appendArgs()
@@ -251,7 +251,8 @@ assert not should_raise and actual == expected, case
foreach ($cases as $case) {
list($desc, $data, $expected) = $case;
list($url, $query) = $data;
- $this->assertEquals($expected, Net_OpenID_appendArgs($url, $query));
+ $this->assertEquals($expected,
+ Auth_OpenID_appendArgs($url, $query));
}
}
}
diff --git a/Tests/Net/OpenID/Parse.php b/Tests/Auth/OpenID/Parse.php
index 52d2180..31cca3b 100644
--- a/Tests/Net/OpenID/Parse.php
+++ b/Tests/Auth/OpenID/Parse.php
@@ -13,10 +13,10 @@
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*/
-require_once('Net/OpenID/Consumer/Parse.php');
+require_once('Auth/OpenID/Consumer/Parse.php');
-class Tests_Net_OpenID_Link extends PHPUnit_TestCase {
- function Tests_Net_OpenID_Link($case)
+class Tests_Auth_OpenID_Link extends PHPUnit_TestCase {
+ function Tests_Auth_OpenID_Link($case)
{
list($desc, $markup, $links, $case_text) = $case;
$this->desc = $desc;
@@ -32,7 +32,7 @@ class Tests_Net_OpenID_Link extends PHPUnit_TestCase {
function runTest()
{
- $parsed = Net_OpenID_parseLinkAttrs($this->markup);
+ $parsed = Auth_OpenID_parseLinkAttrs($this->markup);
$i = 0;
foreach ($this->expected_links as $expected) {
@@ -91,11 +91,11 @@ class NumTestCases extends PHPUnit_TestCase {
}
}
-class Tests_Net_OpenID_Parse extends PHPUnit_TestSuite {
+class Tests_Auth_OpenID_Parse extends PHPUnit_TestSuite {
function getName()
{
- return "Tests_Net_OpenID_Parse";
+ return "Tests_Auth_OpenID_Parse";
}
function parseLink($line)
@@ -154,7 +154,7 @@ class Tests_Net_OpenID_Parse extends PHPUnit_TestSuite {
return array($num_tests, $tests);
}
- function Tests_Net_OpenID_Parse()
+ function Tests_Auth_OpenID_Parse()
{
$here = realpath(dirname(__FILE__));
$test_data_file_name = $here . DIRECTORY_SEPARATOR . 'linkparse.txt';
@@ -165,7 +165,7 @@ class Tests_Net_OpenID_Parse extends PHPUnit_TestSuite {
$this->addTest(new NumTestCases($test_cases, $num_tests));
foreach ($test_cases as $case) {
- $this->addTest(new Tests_Net_OpenID_Link($case));
+ $this->addTest(new Tests_Auth_OpenID_Link($case));
}
}
}
diff --git a/Tests/Net/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php
index c78e921..f87d9b4 100644
--- a/Tests/Net/OpenID/StoreTest.php
+++ b/Tests/Auth/OpenID/StoreTest.php
@@ -13,36 +13,36 @@
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*/
-require_once('Net/OpenID/Association.php');
-require_once('Net/OpenID/CryptUtil.php');
-require_once('Net/OpenID/OIDUtil.php');
+require_once('Auth/OpenID/Association.php');
+require_once('Auth/OpenID/CryptUtil.php');
+require_once('Auth/OpenID/OIDUtil.php');
-class Tests_Net_OpenID_StoreTest extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_StoreTest extends PHPUnit_TestCase {
function setUp()
{
- global $_Net_OpenID_letters, $_Net_OpenID_digits,
- $_Net_OpenID_punct;
+ global $_Auth_OpenID_letters, $_Auth_OpenID_digits,
+ $_Auth_OpenID_punct;
- $this->letters = $_Net_OpenID_letters;
- $this->digits = $_Net_OpenID_digits;
- $this->punct = $_Net_OpenID_punct;
+ $this->letters = $_Auth_OpenID_letters;
+ $this->digits = $_Auth_OpenID_digits;
+ $this->punct = $_Auth_OpenID_punct;
$this->allowed_nonce = $this->letters . $this->digits;
$this->allowed_handle = $this->letters . $this->digits . $this->punct;
}
function generateNonce()
{
- return Net_OpenID_CryptUtil::randomString(8, $this->allowed_nonce);
+ return Auth_OpenID_CryptUtil::randomString(8, $this->allowed_nonce);
}
function genAssoc($now, $issued = 0, $lifetime = 600)
{
- $sec = call_user_func(array('Net_OpenID_CryptUtil', 'randomString'),
+ $sec = call_user_func(array('Auth_OpenID_CryptUtil', 'randomString'),
20);
- $hdl = Net_OpenID_CryptUtil::randomString(128, $this->allowed_handle);
- return new Net_OpenID_Association($hdl, $sec, $now + $issued, $lifetime,
- 'HMAC-SHA1');
+ $hdl = Auth_OpenID_CryptUtil::randomString(128, $this->allowed_handle);
+ return new Auth_OpenID_Association($hdl, $sec, $now + $issued,
+ $lifetime, 'HMAC-SHA1');
}
function _checkRetrieve(&$store, $url, $handle, $expected, $name=null)
@@ -212,21 +212,21 @@ explicitly');
function test_filestore()
{
- require_once('Net/OpenID/Store/FileStore.php');
+ require_once('Auth/OpenID/Store/FileStore.php');
- $temp_dir = Net_OpenID_mkdtemp('/tmp');
+ $temp_dir = Auth_OpenID_mkdtemp('/tmp');
if (!$temp_dir) {
trigger_error('Could not create temporary directory ' .
- 'with Net_OpenID_mkdtemp', E_USER_WARNING);
+ 'with Auth_OpenID_mkdtemp', E_USER_WARNING);
return null;
}
- $store = new Net_OpenID_FileStore($temp_dir);
+ $store = new Auth_OpenID_FileStore($temp_dir);
$this->_testStore($store);
$this->_testNonce($store);
$store->destroy();
}
}
-?> \ No newline at end of file
+?>
diff --git a/Tests/Net/OpenID/dhexch b/Tests/Auth/OpenID/dhexch
index 7a8be07..7a8be07 100644
--- a/Tests/Net/OpenID/dhexch
+++ b/Tests/Auth/OpenID/dhexch
diff --git a/Tests/Net/OpenID/dhpriv b/Tests/Auth/OpenID/dhpriv
index 0fa5231..0fa5231 100644
--- a/Tests/Net/OpenID/dhpriv
+++ b/Tests/Auth/OpenID/dhpriv
diff --git a/Tests/Net/OpenID/hmac.txt b/Tests/Auth/OpenID/hmac.txt
index 4299a96..4299a96 100644
--- a/Tests/Net/OpenID/hmac.txt
+++ b/Tests/Auth/OpenID/hmac.txt
diff --git a/Tests/Net/OpenID/linkparse.txt b/Tests/Auth/OpenID/linkparse.txt
index 2206395..2206395 100644
--- a/Tests/Net/OpenID/linkparse.txt
+++ b/Tests/Auth/OpenID/linkparse.txt
diff --git a/Tests/TestDriver.php b/Tests/TestDriver.php
index a254541..56ccfc1 100644
--- a/Tests/TestDriver.php
+++ b/Tests/TestDriver.php
@@ -18,7 +18,7 @@ require_once 'PHPUnit/GUI/HTML.php';
if (defined('E_STRICT')) {
// PHP 5
- $_Net_OpenID_allowed_deprecation =
+ $_Auth_OpenID_allowed_deprecation =
array('var',
'is_a()'
);
@@ -29,17 +29,17 @@ if (defined('E_STRICT')) {
// Augment this
// regular expression if the bug exists in another version.
if (preg_match('/^5\.1\.1$/', phpversion()) && $errno == 2) {
- $allowed_files = array(array('/Net/OpenID/CryptUtil.php',
+ $allowed_files = array(array('/Auth/OpenID/CryptUtil.php',
'dl'),
- array('/Net/OpenID/OIDUtil.php',
+ array('/Auth/OpenID/OIDUtil.php',
'parse_url'),
- array('/Net/OpenID/Store/FileStore.php',
+ array('/Auth/OpenID/Store/FileStore.php',
'mkdir'),
- array('/Net/OpenID/Store/FileStore.php',
+ array('/Auth/OpenID/Store/FileStore.php',
'stat'),
- array('/Net/OpenID/Store/FileStore.php',
+ array('/Auth/OpenID/Store/FileStore.php',
'fopen'),
- array('/Net/OpenID/Store/FileStore.php',
+ array('/Auth/OpenID/Store/FileStore.php',
'unlink'));
foreach ($allowed_files as $entry) {
@@ -53,17 +53,17 @@ if (defined('E_STRICT')) {
}
}
- global $_Net_OpenID_allowed_deprecation;
+ global $_Auth_OpenID_allowed_deprecation;
switch ($errno) {
case E_STRICT:
// XXX: limit this to files we know about
- foreach ($_Net_OpenID_allowed_deprecation as $depr) {
+ foreach ($_Auth_OpenID_allowed_deprecation as $depr) {
if (strpos($errstr, "$depr: Deprecated.") !== false) {
return;
}
}
- $pat = '/^Non-static method Net_OpenID_[A-Za-z0-9_]+' .
+ $pat = '/^Non-static method Auth_OpenID_[A-Za-z0-9_]+' .
'::[A-Za-z0-9_]+\(\) (cannot|should not) be ' .
'called statically$/';
if (preg_match($pat, $errstr)) {
@@ -127,7 +127,7 @@ function global_require_once($name)
}
}
-$_test_dir = 'Tests/Net/OpenID/';
+$_test_dir = 'Tests/Auth/OpenID/';
$_test_names = array(
'KVForm',
'CryptUtil',
diff --git a/admin/docblocks b/admin/docblocks
index 56cafe6..cb4f9b2 100644
--- a/admin/docblocks
+++ b/admin/docblocks
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#set -e
-bad_files=$(find Net Tests -name \*.php |
+bad_files=$(find Auth Tests -name \*.php |
xargs -l1 /usr/bin/env perl admin/docblocks.pl)
if [ "$bad_files" ]
diff --git a/admin/makedoc.sh b/admin/makedoc.sh
index e5b2560..a6596aa 100644
--- a/admin/makedoc.sh
+++ b/admin/makedoc.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-phpdoc -p -t doc -d Net -ti "JanRain OpenID Library" -dn "OpenID"
+phpdoc -p -t doc -d Auth -ti "JanRain OpenID Library" -dn "OpenID"
diff --git a/admin/mathlib b/admin/mathlib
index d2a7012..6cabc91 100644
--- a/admin/mathlib
+++ b/admin/mathlib
@@ -4,9 +4,9 @@
require_once('adminutil.php');
includeAdd(getParent());
-require_once('Net/OpenID/CryptUtil.php');
+require_once('Auth/OpenID/CryptUtil.php');
-$lib =& Net_OpenID_MathLibrary::getLibWrapper();
+$lib =& Auth_OpenID_MathLibrary::getLibWrapper();
if ($lib === null) {
fwrite(STDERR, 'No math library present\n');
diff --git a/admin/nobadbraces b/admin/nobadbraces
index c72ef80..7573fc7 100644
--- a/admin/nobadbraces
+++ b/admin/nobadbraces
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
-bad_functions=$(find Net Tests -name \*.php |
+bad_functions=$(find Auth Tests -name \*.php |
xargs -l1 --replace=FILENAME /usr/bin/env perl admin/brace_style.pl FILENAME)
if [ "$bad_functions" ]
diff --git a/admin/nobadcase b/admin/nobadcase
index e34aa4e..f3eadf2 100644
--- a/admin/nobadcase
+++ b/admin/nobadcase
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
-bad_true=$(grep -l "TRUE" $(find Net Tests -name \*.php | grep -v darcs))
-bad_false=$(grep -l "FALSE" $(find Net Tests -name \*.php | grep -v darcs))
-bad_null=$(grep -l "NULL" $(find Net Tests -name \*.php | grep -v darcs))
+bad_true=$(grep -l "TRUE" $(find Auth Tests -name \*.php | grep -v darcs))
+bad_false=$(grep -l "FALSE" $(find Auth Tests -name \*.php | grep -v darcs))
+bad_null=$(grep -l "NULL" $(find Auth Tests -name \*.php | grep -v darcs))
if [ "$bad_true" ]
then
diff --git a/admin/nolonglines b/admin/nolonglines
index b857904..6f1eaf1 100644
--- a/admin/nolonglines
+++ b/admin/nolonglines
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-files_with_long_lines=$(find Net Tests -name \*.php |
+files_with_long_lines=$(find Auth Tests -name \*.php |
xargs -l1 wc -L |
awk '$1 > 80 { print $2 }' |
xargs -l1 --replace=FILENAME /usr/bin/env perl admin/longlines.pl FILENAME 80)
diff --git a/admin/open_tag b/admin/open_tag
index 086e761..f60cccc 100644
--- a/admin/open_tag
+++ b/admin/open_tag
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-bad_files=$(find Net Tests -type f -name \*.php |
+bad_files=$(find Auth Tests -type f -name \*.php |
xargs -l1 grep -H -m 1 "<?php" -c |
grep ":0" |
awk -F: '{ print $1 }')
diff --git a/admin/texttest.php b/admin/texttest.php
index 8575500..55f6417 100644
--- a/admin/texttest.php
+++ b/admin/texttest.php
@@ -45,7 +45,7 @@ array_shift($argv);
$t = array_search('--thorough', $argv);
if ($t !== false && $t !== null) {
- define('Tests_Net_OpenID_thorough', true);
+ define('Tests_Auth_OpenID_thorough', true);
}
$suites = loadSuite($argv);
diff --git a/examples/consumer.php b/examples/consumer.php
index 8e79371..cb1d71d 100644
--- a/examples/consumer.php
+++ b/examples/consumer.php
@@ -2,7 +2,7 @@
/**
* A demonstration of the PHP OpenID Consumer. This script assumes
- * Net/OpenID has been installed and is in your PHP include path.
+ * Auth/OpenID has been installed and is in your PHP include path.
*/
/**
@@ -17,9 +17,9 @@ $store_path = "/tmp/_php_consumer_test";
* Require files to use the OpenID consumer. We need the consumer
* itself, an OpenID store implementation, and some utility functions.
*/
-require_once("Net/OpenID/Store/FileStore.php");
-require_once("Net/OpenID/Consumer/Consumer.php");
-require_once("Net/OpenID/OIDUtil.php");
+require_once("Auth/OpenID/Store/FileStore.php");
+require_once("Auth/OpenID/Consumer/Consumer.php");
+require_once("Auth/OpenID/OIDUtil.php");
/**
* Try to create the store directory.
@@ -34,8 +34,8 @@ if (!_ensureDir($store_path)) {
* Create the OpenID store and consumer objects, which we'll use to
* perform the authentication.
*/
-$store = new Net_OpenID_FileStore($store_path);
-$consumer = new Net_OpenID_Consumer($store);
+$store = new Auth_OpenID_FileStore($store_path);
+$consumer = new Auth_OpenID_Consumer($store);
/**
* Start the PHP session.
@@ -190,9 +190,9 @@ function render($message = null, $css_class = null,
function verify()
{
global $consumer, $urls, $self_url,
- $Net_OpenID_HTTP_FAILURE,
- $Net_OpenID_PARSE_ERROR,
- $Net_OpenID_SUCCESS;
+ $Auth_OpenID_HTTP_FAILURE,
+ $Auth_OpenID_PARSE_ERROR,
+ $Auth_OpenID_SUCCESS;
// Render a default page if we got a submission without an
// openid_url value.
@@ -208,13 +208,13 @@ function verify()
list($status, $info) = $consumer->beginAuth($openid_url);
// Handle failure status return values.
- if (in_array($status, array($Net_OpenID_HTTP_FAILURE, $Net_OpenID_PARSE_ERROR))) {
- if ($status == $Net_OpenID_HTTP_FAILURE) {
+ if (in_array($status, array($Auth_OpenID_HTTP_FAILURE, $Auth_OpenID_PARSE_ERROR))) {
+ if ($status == $Auth_OpenID_HTTP_FAILURE) {
render("HTTP failure");
} else {
render("HTTP Parse error");
}
- } else if ($status == $Net_OpenID_SUCCESS) {
+ } else if ($status == $Auth_OpenID_SUCCESS) {
// If we got a successful return, continue the auth by
// redirecting the user agent to the OpenID server. Be sure
// to give the server a URL that will cause this script's
@@ -236,8 +236,8 @@ function verify()
function process()
{
global $consumer,
- $Net_OpenID_SUCCESS,
- $Net_OpenID_FAILURE;
+ $Auth_OpenID_SUCCESS,
+ $Auth_OpenID_FAILURE;
// Retrieve the token from the session.
$token = $_SESSION['openid_token'];
@@ -250,7 +250,7 @@ function process()
// Because PHP mangles CGI names by replacing dots with
// underscores, try to fix the reponse by replacing underscores
// with dots so we can look for openid.* values.
- $data = Net_OpenID_Consumer::fixResponse($_GET);
+ $data = Auth_OpenID_Consumer::fixResponse($_GET);
// Complete the authentication process using the server's
// response.
@@ -260,7 +260,7 @@ function process()
$openid_url = null;
// React to the server's response status.
- if (($status == $Net_OpenID_FAILURE) &&
+ if (($status == $Auth_OpenID_FAILURE) &&
$info) {
// In the case of failure, if info is non-None, it is the URL
// that we were verifying. We include it in the error message
@@ -268,7 +268,7 @@ function process()
$openid_url = $info;
$fmt = "Verification of %s failed.";
$message = sprintf($fmt, $openid_url);
- } else if ($status == $Net_OpenID_SUCCESS) {
+ } else if ($status == $Auth_OpenID_SUCCESS) {
// Success means that the transaction completed without
// error. If info is None, it means that the user cancelled
// the verification.