From 0520579f3cd00e5dc8570cd9685098a311523d17 Mon Sep 17 00:00:00 2001 From: Justin Greer Date: Tue, 13 May 2014 21:42:24 -0400 Subject: [PATCH] Updated to 2.0.0 There was some major changes and tweaks made to the plugin. Too many updates to mention. Read the read me file detailed information. --- README.md | 21 +- client-example/callback_login.php | 99 ++++ client-example/index.php | 35 ++ lib/classes/OAuth2.php | 19 +- lib/classes/OAuth2_API.php | 49 +- lib/classes/admin/IOAuth2Storage.php | 29 +- lib/classes/admin/OAuthMain.php | 4 +- lib/classes/log.txt | 663 +++++++++++++++++++++++++++ lib/dashboard.php | 28 +- lib/rewrites.php | 66 +++ wp_oauth2-complete.php | 406 +++++++--------- 11 files changed, 1090 insertions(+), 329 deletions(-) create mode 100644 client-example/callback_login.php create mode 100644 client-example/index.php create mode 100644 lib/classes/log.txt create mode 100644 lib/rewrites.php diff --git a/README.md b/README.md index 8eaf1d2..8f01e80 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,18 @@ Your site will be able to provide Single Sign On and also deliver authorized user data using the OAuth 2.0 API. -Contributors: Justin Greer, Joel Wickard +Contributors: Justin Greer, Joel Wickard, Neil Pullman Requires at least: 3.4.2 Tested up to: 3.7 -Stable tag: 1.0.4 +Stable tag: 2.0.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html ## Description +ENSURE THAT WP_DEBUG IS SET TO FALSE IN THE WP-CONFIG.PHP FILE..... NO JOKE!!!! + OAuth2 Complete is a ONE OF A KIND plugin that instantly turns your WordPress webste into a valid OAuth v2 provider. The plugin is built using OAuth2 Draft 20 standards. The backend is designed to be extremely easy to use for any level of experience. OAuth is a great tool but leaves most developers behind since it a bit technical. The plugin has aleady done the hard part for you. @@ -57,7 +59,7 @@ Request Token Requires only 4 parameters * grant_type - Supported value's = `authorization_code` * client_id * client_secret -* Example call `http://example.com/oauth/request_token?code=the_auth_key_sent_back_from_the_authorize_call&grant_typ=authorization_code&client_id=the_client_id&client_secret=the_client_secret` +* Example call `http://example.com/oauth/request_token?code=the_auth_key_sent_back_from_the_authorize_call&grant_type=authorization_code&client_id=the_client_id&client_secret=the_client_secret` Request Access Requires only 1 parmeter @@ -100,3 +102,16 @@ When upgrading OAuth2 Provider, I seriously recommend creating a backup of your ### 1.0.4 * Fixed short tag in login layout * Filtered out hashed password / user activation key from returned oauth data. + +## 2.0.0 +* Rebuild init plugin code struture for more flexibilty and scalability. +* Added prefix to all DB connections +* Changed install query to use the InnoDB engine for better support and performance. +* Fixed improper loading of plugin stylesheet. +* Removed garbage data when plugin is activated. It was not being used and cluttering the codebase as well as the database. +* Move action template_redirect to rewrites file +* Added login form support for installs that are installed in sub directory +* Added missing in documentation for when calling requesting_token +* Suppressed some errors that was preventing a proper JSON return when `WP_DEBUG` was enabled. +* Added a client sample script to help learn the baiscs of connecting to the provider plugin. +* Add legacy installer that will hopfully keep old data in tacked while updating to the new structure with no data loss. diff --git a/client-example/callback_login.php b/client-example/callback_login.php new file mode 100644 index 0000000..759d613 --- /dev/null +++ b/client-example/callback_login.php @@ -0,0 +1,99 @@ +"; +print "2. Preparing to Request Token with token ".$_GET['code']."
"; + +/** + * This is not ideal for production at all + * + * Here you can take the code provided by provide after the authorize call and passit back + * to request access. + * ( If the user is not logged in, they should be presented with a login screen ) + */ + +///////////////////////////// +// +// STEP 1 - REQUEST TOKEN +// +///////////////////////////// +$url = "http://development.dev/oauth/request_token?code=".$_GET['code']."&grant_type=authorization_code&client_id=".$clientID."&client_secret=".$clientSecret; +$ch = curl_init(); +curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); +curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_AUTOREFERER, true); +curl_setopt($ch, CURLOPT_URL,$url); +curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); +$result = curl_exec($ch); +curl_close($ch); +$result = json_decode( $result ); + +// Handle the response as you see fit +print '3. Response from provider:
';
+print_r( $result );
+print '
'; + +if( isset( $result->error) ) + die("ERROR: There was an error present. This is where you would use [error_description] to your liking."); + +// YOU COULD STOP HERE IS ALL YOU NEEDED WAS TO AUTHORIZE THE USER (SINGLE SIGN ON). IF YOU WANT TO GATHER THERE ACCOUNT INFORMATION YOU +// CAN GO TO STEP 4. + +//////////////////////////////////////////////////////// +// +// STEP 2 - REQUEST ACCESS TO USER INFORMATION +// +//////////////////////////////////////////////////////// + +// Use the return from above to and do as you please but you will need the acces_token at a minimum +print '4. Preparing the acces_token call
'; +$url = "http://development.dev/oauth/request_access?access_token=". $result->access_token; + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); +curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_AUTOREFERER, true); +curl_setopt($ch, CURLOPT_URL,$url); +curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); +$result = curl_exec($ch); +curl_close($ch); +$result = json_decode( $result ); + +print '5. Response from provider:
';
+print_r( $result );
+print '
'; + +if( isset( $result->error) ) + die("ERROR: There was an error present. This is where you would use [error_description] to your liking."); + +///////////////////////////////////// +// +// STEP 3 - LOG USER IN ON YOUR SIDE +// +///////////////////////////////////// + +// As long as everything went ok here, you +if( !isset( $result->error) ) + print 'Here is where you can use the users information provided by the provider to set a user session and then redirect the user elsewhere'; \ No newline at end of file diff --git a/client-example/index.php b/client-example/index.php new file mode 100644 index 0000000..78820b2 --- /dev/null +++ b/client-example/index.php @@ -0,0 +1,35 @@ + + * @license GPL2 + */ + +/** + * session_start + * In this example we will use simple sessions + * You can use cookies or any means to track user login status. It is up to you! + */ +session_start(); + +// Check if the user is logged in. This is simple for demonstration purposes +if( ! isset( $_SESSION['loggedIn'] ) ) + $_SESSION['loggedIn'] = false; +?> + + + + WP Oauth2 Client - Example + + + + Login + + Welcome Back - Logout + + + + + \ No newline at end of file diff --git a/lib/classes/OAuth2.php b/lib/classes/OAuth2.php index 2773b81..7c00853 100644 --- a/lib/classes/OAuth2.php +++ b/lib/classes/OAuth2.php @@ -7,9 +7,9 @@ * OAuth2 hook for WordPress * * @category PHP - * @author Modified Justin Greer + * @author Modified Justin Greer * @license http://www.gnu.org/licenses/gpl.html - * @link http://justin-greer.com + * @link http://blackbirdi.com */ class OAuth2 { @@ -437,6 +437,10 @@ public function grantAccessToken(array $inputData = NULL, array $authHeaders = N // Filter input data $input = $inputData; + + // Added due to server strict policys and was causing kaos in my head + if( !isset($input['redirect_uri']) ) + $input['redirect_uri'] = NULL; // Grant Type must be specified. if (!$input["grant_type"]) { @@ -567,6 +571,11 @@ public function grantAccessToken(array $inputData = NULL, array $authHeaders = N $stored["scope"] = NULL; } + // Added to make things easier for now. + if (!isset($input["scope"])) { + $input["scope"] = NULL; + } + // Check scope, if provided if ($input["scope"] && (!is_array($stored) || !isset($stored["scope"]) || !$this->checkScope($input["scope"], $stored["scope"]))) { throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_SCOPE, 'An unsupported scope was requested.'); @@ -577,7 +586,7 @@ public function grantAccessToken(array $inputData = NULL, array $authHeaders = N // Send response $this->sendJsonHeaders(); - echo json_encode($token); + echo json_encode( $token ); } /** @@ -677,7 +686,7 @@ public function getAuthorizeParams($inputData) { if ($this->getVariable(self::CONFIG_ENFORCE_INPUT_REDIRECT) && !$input["redirect_uri"]) { header("Content-Type: application/json"); header("Cache-Control: no-store"); - $error = json_encode(array('Error' => 'redirect_uri is require by the OAuth API')); + $error = json_encode(array('Error' => 'redirect_uri is require by Mydwellworks OAuth API')); echo $error; exit; } @@ -723,7 +732,7 @@ public function getAuthorizeParams($inputData) { if ($this->getVariable(self::CONFIG_ENFORCE_STATE) && !$input["state"]) { header("Content-Type: application/json"); header("Cache-Control: no-store"); - $error = json_encode(array('Error' => 'state is required')); + $error = json_encode(array('Error' => 'state is required by Mydwellworks')); echo $error; exit; } diff --git a/lib/classes/OAuth2_API.php b/lib/classes/OAuth2_API.php index 822a80c..f36b467 100644 --- a/lib/classes/OAuth2_API.php +++ b/lib/classes/OAuth2_API.php @@ -5,10 +5,11 @@ * @author Justin Greer */ global $wp_query; + /** * Require OAuth Storage */ -require_once( dirname(__FILE__) .'/admin/IOAuth2Storage.php' ); +require_once( dirname(__FILE__) . '/admin/IOAuth2Storage.php' ); /** * @var Set the object @@ -19,7 +20,6 @@ * @var Clean the method from the query up a bit if needed */ $method = $wp_query->get('oauth'); - $allowed = array( 'authorize', // Authorize a user 'request_token', // Request a Token @@ -35,7 +35,7 @@ $file = dirname(__FILE__).'/log.txt'; $log = "Incomming Connection:".date("D F j")." at ".date("g:i:s a")."\n"; $log .= "Method Being Called: ". $method ."\n"; - $log .= $_SERVER['HTTP_REFERER']."\n"; + $log .= @$_SERVER['HTTP_REFERER']."\n"; foreach ($_GET as $name => $value) { $log .= "$name: $value\n"; } @@ -59,15 +59,9 @@ switch($method){ case 'authorize': - - /** - * Prevention check - */ + header('X-Frame-Options: DENY'); - /** - *Check for client_id - */ if (!isset($_GET['client_id']) || empty($_GET['client_id'])){ header("Content-Type: application/json"); header("Cache-Control: no-store"); @@ -75,10 +69,7 @@ echo $error; exit; } - - /** - * Check for state - */ + if(!isset($_GET['state']) || empty($_GET['state'])){ header("Content-Type: application/json"); header("Cache-Control: no-store"); @@ -87,11 +78,8 @@ exit; } - /** - * If the user is not logged in then redirect them to the OAuth Login - */ - if (!is_user_logged_in()) { - wp_redirect('/oauth/login?sso_redirect='.$_GET['client_id'].'&state='.$_GET['state']); + if ( !is_user_logged_in() ) { + wp_redirect( site_url() . '/oauth/login?sso_redirect='.$_GET['client_id'].'&state='.$_GET['state']); exit(); } @@ -105,7 +93,7 @@ */ $userId = $current_user->ID; - // JUST IN CASE ONLY RUN IF $user_id HAS BEEN SET + // @todo Not too sure what this is doing but we need to look at it. if($userId != ''){ $oauth->finishClientAuthorization(TRUE, $userId, $_GET); // AUTO AUTHORIZE } @@ -116,19 +104,18 @@ $oauthError->sendHttpResponse(); } - break; + break; case 'request_token': - header('X-Frame-Options: DENY'); - - try { - $oauth->grantAccessToken(); - } catch (OAuth2ServerException $oauthError) { - $oauthError->sendHttpResponse(); - } - - break; + header('X-Frame-Options: DENY'); + try { + $oauth->grantAccessToken(); + } catch (OAuth2ServerException $oauthError) { + $oauthError->sendHttpResponse(); + } + + break; case 'request_access': @@ -142,7 +129,7 @@ global $wpdb; $info = $wpdb->get_row("SELECT * FROM wp_users WHERE ID = ".$user_id.""); - //don't send sensitive info accross the wire. + // don't send sensitive info accross the wire. unset($info->user_pass); unset($info->user_activation_key); diff --git a/lib/classes/admin/IOAuth2Storage.php b/lib/classes/admin/IOAuth2Storage.php index cc66e3e..6b6ef5e 100644 --- a/lib/classes/admin/IOAuth2Storage.php +++ b/lib/classes/admin/IOAuth2Storage.php @@ -9,13 +9,6 @@ /** * IOAuth2StorageWP class is used in for the admin functions in via the admin panel. - * - * - * @category PHP - * @author Justin Greer - * @license http://www.gnu.org/licenses/gpl.html - * @link http://justin-greer.com - * @copyright 2013 Justin Greer */ class IOAuth2StorageWP implements IOAuth2GrantCode, IOAuth2RefreshTokens{ @@ -48,7 +41,7 @@ public function addClient($mdop_name, $client_redirect) { $client_secret = $this->generateSecret(); global $wpdb; - $addClient = $wpdb->insert('oauth2_clients',array('name'=>$mdop_name, 'client_id' => trim(rtrim($client_id)), 'client_secret' => $client_secret, 'redirect_uri' => $client_redirect)); + $addClient = $wpdb->insert($wpdb->prefix . 'oauth2_clients',array('name'=>$mdop_name, 'client_id' => trim(rtrim($client_id)), 'client_secret' => $client_secret, 'redirect_uri' => $client_redirect)); if (!$addClient){ $this->handleException('Could not add Client'); }else{ @@ -68,7 +61,7 @@ public function addClient($mdop_name, $client_redirect) { */ public function checkClientCredentials($client_id, $client_secret) { global $wpdb; - $wpdb->query("SELECT client_id, client_secret FROM oauth2_clients WHERE client_id = '$client_id' AND client_secret = '$client_secret'"); + $wpdb->query("SELECT client_id, client_secret FROM {$wpdb->prefix}oauth2_clients WHERE client_id = '$client_id' AND client_secret = '$client_secret'"); if ($wpdb->num_rows > 0){ return TRUE; }else{ @@ -85,7 +78,7 @@ public function checkClientCredentials($client_id, $client_secret) { */ public function getClientDetails($client_id) { global $wpdb; - $info = $wpdb->get_results("SELECT * FROM oauth2_clients WHERE client_id = '$client_id'", ARRAY_A ); + $info = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}oauth2_clients WHERE client_id = '$client_id'", ARRAY_A ); if ($wpdb->num_rows > 0){ return $info[0]; }else{ @@ -134,7 +127,7 @@ public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, */ public function unsetRefreshToken($refresh_token) { global $wpdb; - $deleteToken = $wpd->query("DELETE FROM oauth2_refresh_tokens WHERE refresh_token = '$refresh_token'"); + $deleteToken = $wpd->query("DELETE FROM {$wpdb->prefix}oauth2_refresh_tokens WHERE refresh_token = '$refresh_token'"); if (!$deleteToken){ $this->handleException('Could not delete refresh token'); // THROW ERROR } @@ -145,7 +138,7 @@ public function unsetRefreshToken($refresh_token) { */ public function getAuthCode($code) { global $wpdb; - $select = $wpdb->get_results("SELECT code, client_id, user_id, redirect_uri, expires, scope FROM oauth2_auth_codes WHERE code = '$code'", ARRAY_A ); + $select = $wpdb->get_results("SELECT code, client_id, user_id, redirect_uri, expires, scope FROM {$wpdb->prefix}oauth2_auth_codes WHERE code = '$code'", ARRAY_A ); if ($wpdb->num_rows > 0){ return $select[0]; @@ -166,7 +159,7 @@ public function getAuthCode($code) { */ public function setAuthCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = NULL) { global $wpdb; - $set = $wpdb->insert('oauth2_auth_codes',array('code' => $code, 'client_id' => $client_id, 'user_id' => $user_id, 'redirect_uri' => $redirect_uri, 'expires' => $expires, 'scope' => $scope )); + $set = $wpdb->insert($wpdb->prefix.'oauth2_auth_codes',array('code' => $code, 'client_id' => $client_id, 'user_id' => $user_id, 'redirect_uri' => $redirect_uri, 'expires' => $expires, 'scope' => $scope )); if (!$set){ $this->handleException('Failed to set token'); } @@ -190,12 +183,12 @@ public function checkRestrictedGrantType($client_id, $grant_type) { * @param bool $isRefresh */ protected function setToken($token, $client_id, $user_id, $expires, $scope, $isRefresh = TRUE) { + global $wpdb; if ($isRefresh == TRUE){ - $tablename = 'oauth2_refresh_tokens'; + $tablename = $wpdb->prefix.'oauth2_refresh_tokens'; }else{ - $tablename = 'oauth2_access_tokens'; + $tablename = $wpdb->prefix.'oauth2_access_tokens'; } - global $wpdb; $set = $wpdb->insert($tablename,array('oauth_token' => $token, 'client_id' => $client_id, 'user_id' => $user_id, 'expires' => $expires, 'scope' => $scope )); if ($set){ return TRUE; @@ -211,9 +204,9 @@ protected function setToken($token, $client_id, $user_id, $expires, $scope, $isR protected function getToken($token, $isRefresh) { global $wpdb; if ($isRefresh == TRUE){ - $tablename = 'oauth2_refresh_tokens'; + $tablename = $wpdb->prefix.'oauth2_refresh_tokens'; }else{ - $tablename = 'oauth2_access_tokens'; + $tablename = $wpdb->prefix.'oauth2_access_tokens'; } $token = $wpdb->get_results("SELECT * FROM $tablename WHERE oauth_token = '$token'", ARRAY_A ); return $token[0]; diff --git a/lib/classes/admin/OAuthMain.php b/lib/classes/admin/OAuthMain.php index 4b44708..4161722 100644 --- a/lib/classes/admin/OAuthMain.php +++ b/lib/classes/admin/OAuthMain.php @@ -18,7 +18,7 @@ public function __destruct(){} */ public function ConsumerCount(){ global $wpdb; - $count = $wpdb->query("SELECT * FROM oauth2_clients"); + $count = $wpdb->query("SELECT * FROM {$wpdb->prefix}oauth2_clients"); return $wpdb->num_rows; } @@ -29,7 +29,7 @@ public function ConsumerCount(){ */ public function listConsumers(){ global $wpdb; - $results = $wpdb->get_results("SELECT * FROM oauth2_clients"); + $results = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}oauth2_clients"); foreach($results as $single){ print ''; print '' . $single->name . ''; diff --git a/lib/classes/log.txt b/lib/classes/log.txt new file mode 100644 index 0000000..a77e9a4 --- /dev/null +++ b/lib/classes/log.txt @@ -0,0 +1,663 @@ +Incomming Connection:Tue May 13 at 11:23:16 pm +Method Being Called: authorize + +========================= +Incomming Connection:Tue May 13 at 11:23:27 pm +Method Being Called: authorize + +========================= +Incomming Connection:Tue May 13 at 11:23:30 pm +Method Being Called: authorize + +========================= +Incomming Connection:Tue May 13 at 11:23:45 pm +Method Being Called: authorize + +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +========================= +Incomming Connection:Tue May 13 at 11:24:01 pm +Method Being Called: authorize + +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Tue May 13 at 11:24:13 pm +Method Being Called: authorize + +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:32:29 pm +Method Being Called: authorize + +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Tue May 13 at 11:38:34 pm +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:45:26 pm +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:46:09 pm +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:50:19 pm +Method Being Called: authorize + +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Tue May 13 at 11:50:21 pm +Method Being Called: authorize + +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +========================= +Incomming Connection:Tue May 13 at 11:50:31 pm +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:54:17 pm +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:54:17 pm +Method Being Called: login +http://oauthclient.dev/ +sso_redirect: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Tue May 13 at 11:54:27 pm +Method Being Called: login +http://development.dev/oauth/login/?sso_redirect=b953042c39dc30f07004a54e916acc9aa0bc7751&state=someuidparameter +sso_redirect: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Tue May 13 at 11:54:30 pm +Method Being Called: login +http://development.dev/oauth/login/?sso_redirect=b953042c39dc30f07004a54e916acc9aa0bc7751&state=someuidparameter +sso_redirect: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Tue May 13 at 11:54:31 pm +Method Being Called: authorize +http://development.dev/oauth/login/?sso_redirect=b953042c39dc30f07004a54e916acc9aa0bc7751&state=someuidparameter +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:58:11 pm +Method Being Called: login +http://oauthclient.dev/ +sso_redirect: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Tue May 13 at 11:58:14 pm +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Tue May 13 at 11:58:37 pm +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:11:47 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:25:54 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:26:30 am +Method Being Called: request_token + +========================= +Incomming Connection:Wed May 14 at 12:27:15 am +Method Being Called: request_token + +========================= +Incomming Connection:Wed May 14 at 12:28:39 am +Method Being Called: request_token + +grant_type: asd +========================= +Incomming Connection:Wed May 14 at 12:29:12 am +Method Being Called: request_token + +grant_type: asd +========================= +Incomming Connection:Wed May 14 at 12:29:18 am +Method Being Called: request_token + +code: 12345 +grant_typ: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:29:26 am +Method Being Called: request_token + +code: 12345 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:29:28 am +Method Being Called: request_token + +code: 12345 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:29:41 am +Method Being Called: request_token + +code: 12345 +grant_typ: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:29:43 am +Method Being Called: request_token + +grant_type: asd +========================= +Incomming Connection:Wed May 14 at 12:29:43 am +Method Being Called: request_token + +========================= +Incomming Connection:Wed May 14 at 12:29:47 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:30:02 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:31:28 am +Method Being Called: request_token + +code: 35ffbb8159f712fc59697ac013093c9b4cd126b8 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:31:37 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:31:43 am +Method Being Called: request_token + +code: e770354135d9b2f2a82f522a3a612aa2671814fe +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:33:29 am +Method Being Called: request_token + +code: 35ffbb8159f712fc59697ac013093c9b4cd126b8 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:33:35 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:36:14 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:36:42 am +Method Being Called: request_token + +code: 5736e10fc1dde504e666808861eb8aff50626986 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:36:52 am +Method Being Called: request_token + +code: 5736e10fc1dde504e666808861eb8aff50626986 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:36:58 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:37:05 am +Method Being Called: request_token + +code: af9cf6bb99d5b6cc976a2f0d60a1492480b53a94 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:37:36 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:37:36 am +Method Being Called: login +http://oauthclient.dev/ +sso_redirect: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Wed May 14 at 12:37:39 am +Method Being Called: login +http://development.dev/oauth/login/?sso_redirect=b953042c39dc30f07004a54e916acc9aa0bc7751&state=someuidparameter +sso_redirect: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Wed May 14 at 12:37:39 am +Method Being Called: authorize +http://development.dev/oauth/login/?sso_redirect=b953042c39dc30f07004a54e916acc9aa0bc7751&state=someuidparameter +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:39:04 am +Method Being Called: login +http://oauthclient.dev/ +sso_redirect: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +========================= +Incomming Connection:Wed May 14 at 12:39:11 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:41:10 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:41:34 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=f22f3e95501babe69dae2f27950372a16ccaba7b&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: f22f3e95501babe69dae2f27950372a16ccaba7b +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:41:36 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=f22f3e95501babe69dae2f27950372a16ccaba7b&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: f22f3e95501babe69dae2f27950372a16ccaba7b +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:41:39 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:41:40 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:45:17 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:45:19 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:46:08 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:46:13 am +Method Being Called: request_token + +code: 9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:47:08 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:48:12 am +Method Being Called: request_token + +code: 9e347e59eb8712ecfce0b58f0d4a8294c5ab7ef7 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:48:21 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:48:45 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=c70c6a187dd861c12f4112e6d7e301b5af3a9e8f&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: c70c6a187dd861c12f4112e6d7e301b5af3a9e8f +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:51:26 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=c70c6a187dd861c12f4112e6d7e301b5af3a9e8f&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: c70c6a187dd861c12f4112e6d7e301b5af3a9e8f +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:53:06 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=c70c6a187dd861c12f4112e6d7e301b5af3a9e8f&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: c70c6a187dd861c12f4112e6d7e301b5af3a9e8f +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:53:19 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=c70c6a187dd861c12f4112e6d7e301b5af3a9e8f&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: c70c6a187dd861c12f4112e6d7e301b5af3a9e8f +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:53:23 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=c70c6a187dd861c12f4112e6d7e301b5af3a9e8f&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: c70c6a187dd861c12f4112e6d7e301b5af3a9e8f +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:53:28 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:53:29 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=5e747eb88217776d24c5409653d5fd160f482bc2&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 5e747eb88217776d24c5409653d5fd160f482bc2 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:54:25 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=5e747eb88217776d24c5409653d5fd160f482bc2&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 5e747eb88217776d24c5409653d5fd160f482bc2 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:54:30 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:54:31 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d0961dd87816a9904c78ef06728d5c55ca5d0ba9&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d0961dd87816a9904c78ef06728d5c55ca5d0ba9 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:54:56 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d0961dd87816a9904c78ef06728d5c55ca5d0ba9&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d0961dd87816a9904c78ef06728d5c55ca5d0ba9 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:57:38 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d0961dd87816a9904c78ef06728d5c55ca5d0ba9&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d0961dd87816a9904c78ef06728d5c55ca5d0ba9 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:57:38 am +Method Being Called: request_access +http://development.dev/oauth/request_access?access_token= +access_token: +========================= +Incomming Connection:Wed May 14 at 12:57:52 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 12:57:53 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:57:54 am +Method Being Called: request_access +http://development.dev/oauth/request_access?access_token=458b0d86c6a756f65b60e4ccf2747ef8cb5dfdc1 +access_token: 458b0d86c6a756f65b60e4ccf2747ef8cb5dfdc1 +========================= +Incomming Connection:Wed May 14 at 12:58:55 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:59:09 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 12:59:10 am +Method Being Called: request_access +http://development.dev/oauth/request_access?access_token= +access_token: +========================= +Incomming Connection:Wed May 14 at 1:00:59 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:01:47 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: d89f0cd41bd4a5212c3b97d7545d09bb0a5c6482 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:07:43 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 1:07:44 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=589a62b0045c678f2aa23676446eb41f2749d660&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 589a62b0045c678f2aa23676446eb41f2749d660 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:07:44 am +Method Being Called: request_access +http://development.dev/oauth/request_access?access_token=6afe1d5c32d6c2ea4d3a1515a7bff3744a5c1404 +access_token: 6afe1d5c32d6c2ea4d3a1515a7bff3744a5c1404 +========================= +Incomming Connection:Wed May 14 at 1:08:13 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=589a62b0045c678f2aa23676446eb41f2749d660&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 589a62b0045c678f2aa23676446eb41f2749d660 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:08:14 am +Method Being Called: request_access +http://development.dev/oauth/request_access?access_token=3bc4d403dd98f5cea220d8936660a8d321e4ea4a +access_token: 3bc4d403dd98f5cea220d8936660a8d321e4ea4a +========================= +Incomming Connection:Wed May 14 at 1:08:29 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=589a62b0045c678f2aa23676446eb41f2749d660&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 589a62b0045c678f2aa23676446eb41f2749d660 +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:08:35 am +Method Being Called: authorize +http://oauthclient.dev/ +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +state: someuidparameter +response_type: code +========================= +Incomming Connection:Wed May 14 at 1:08:36 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:08:36 am +Method Being Called: request_access +http://development.dev/oauth/request_access?access_token=f1bb2d9c4b59792873219aa98639fcd8e60da1db +access_token: f1bb2d9c4b59792873219aa98639fcd8e60da1db +========================= +Incomming Connection:Wed May 14 at 1:10:23 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:13:43 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= +Incomming Connection:Wed May 14 at 1:19:43 am +Method Being Called: request_token +http://development.dev/oauth/request_token?code=6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc&grant_type=authorization_code&client_id=b953042c39dc30f07004a54e916acc9aa0bc7751&client_secret=3982b878f6f0704e1045 +code: 6f3f0a3b568bf3311ba97d9c158d80ba1fd0c6bc +grant_type: authorization_code +client_id: b953042c39dc30f07004a54e916acc9aa0bc7751 +client_secret: 3982b878f6f0704e1045 +========================= diff --git a/lib/dashboard.php b/lib/dashboard.php index b118f50..a800865 100644 --- a/lib/dashboard.php +++ b/lib/dashboard.php @@ -15,46 +15,30 @@ function wp_oauth2_complete_init_dashboard() { $messageType; // MESSAGE TYPE HOLDER $messagetext; // MESSAGE TEXT HOLDER - wp_enqueue_style('wp_oauth2_provider_stylesheet'); + wp_register_style( 'wp_oauth2_provider_stylesheet', WP_OAUTH2_URL . '/lib/assets/css/layout.css' ); + wp_enqueue_style('wp_oauth2_provider_stylesheet' ); if(isset($_POST['op2action']) && $_POST['op2action'] == 'Add Client'){ $oauthStorage->addClient($_POST['mdop_name'], $_POST['mdop_redirect_uri']); } if(isset($_GET['delete']) && $_GET['delete'] != ''){ global $wpdb; - $wpdb->delete('oauth2_clients', array('client_id'=> $_GET['delete'])); + $wpdb->delete($wpdb->prefix.'oauth2_clients', array('client_id'=> $_GET['delete'])); } // Added to be used through out the plugin backend $adminUrl = admin_url(); ?> -

WordPress OAuth2 Provider

+

WordPress OAuth2 Provider


diff --git a/lib/rewrites.php b/lib/rewrites.php new file mode 100644 index 0000000..398f1d7 --- /dev/null +++ b/lib/rewrites.php @@ -0,0 +1,66 @@ + 'index.php?oauth='.$wp_rewrite->preg_index(1)); + $newRules = $newRule + $rules; + return $newRules; + } + + function add_query_vars($qvars) { + $qvars[] = 'oauth'; + return $qvars; + } + + function flush_rewrite_rules() { + global $wp_rewrite; + $wp_rewrite->flush_rules(); + } + + /** + * template_redirect_intercept + * Template redirect for WP OAuth2 + * @param {} + */ + function template_redirect_intercept() { + global $wp_query; + if ($wp_query->get('oauth')) { + require_once( dirname(__FILE__) . '/classes/OAuth2_API.php' ); + exit; + } + } + + /** + * Creates a JSON output + * + * @since 1.0.0 + * @uses output + * @deprecated Generic Output. Not needed or used not more. Scheduled to be removed 1.0.6 + */ + function pushoutput($message) { + $this->output($message); + } + + function output( $output ) { + header( 'Cache-Control: no-cache, must-revalidate' ); + header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); + echo json_encode( $output ); + } +} +$OAuth2RewritesCode = new OAuth2Rewrites(); + +/** + * Create all the hooks the link this all together with WordPress + */ +add_filter( 'rewrite_rules_array' , array( $OAuth2RewritesCode , 'create_rewrite_rules' )); +add_filter( 'query_vars' , array( $OAuth2RewritesCode , 'add_query_vars')); +add_filter( 'wp_loaded' , array( $OAuth2RewritesCode , 'flush_rewrite_rules')); + +add_action( 'template_redirect', array( $OAuth2RewritesCode, 'template_redirect_intercept') ); \ No newline at end of file diff --git a/wp_oauth2-complete.php b/wp_oauth2-complete.php index c9b0d4d..fb4781c 100644 --- a/wp_oauth2-complete.php +++ b/wp_oauth2-complete.php @@ -1,279 +1,189 @@ insert( 'oauth2_options', array( 'version' => $wp_oath2_complete_version, 'enabled' => 1, 'draft'=> '20') ); -} - + public $version = '2.0.0'; -/** - * Run the install of the tables - */ -register_activation_hook(__FILE__,'wp_oauth2_complete_install'); // REGISTER THE CREATION OF THE TABLE -register_activation_hook(__FILE__,'wp_oauth2_complete_install_data'); // REGISTER THE INSTALLATION OF THE INTIAL DATA + /** + * _construct + */ + function __construct(){ + add_action( 'plugins_loaded' , array( $this, '_init' )); + add_action( 'wp_enqueue_scripts', array( $this, '_registerStyles') ); + add_action( 'admin_menu', array( $this, '_adminMenu') ); + } + /** + * _start + * Defines all the basic awesomness that is needed thoughout the plguin + * @action wp_oauth2_start + */ + function _start(){ + do_action( 'wp_oauth2_start' ); + define( 'WP_OAUTH2_PATH', plugin_dir_path(__FILE__)); + define( 'WP_OAUTH2_ABSPATH' , dirname( __FILE__ ) ); + define( 'WP_OAUTH2_URL', plugins_url('/', __FILE__ ) ); + } -/** - * OAuth2 Provider WordPress Rewrite rules class - * DON NOT TOUCH THIS CLASS UNLESS YOU KNOW WHAT YOU ARE DOING - * - * @since 1.0.0 - */ -class OAuth2Rewrites { + /** + * _init + * Kickstarts the plugin + * @action wp_oauth2_init + */ + function _init(){ + do_action( "wp_oauth2_init" ); + $this->_start(); + $this->_includes(); + $this->_load(); + } /** - * Activates the rewrite rules + * _includes + * Inludes all the init files for the plugin * - * @todo Run this function only when the plugin is acivated + * @action wp_oauth2_init + * @todo move all the includes into an array and pass them through a filter. + * This will allow for developers to create custom hooks if need be. */ - function activate() { - - /** - * Rewrite Hook - * @global object $wp_rewrite WordPress hook for rewriting pretty URLs - */ - global $wp_rewrite; - - /** - * Flush the rewrites so the changes can take effect - */ - $this->flush_rewrite_rules(); - } + function _includes(){ + do_action( "wp_oauth2_init" ); + require_once( dirname(__FILE__).'/lib/dashboard.php'); + require_once( dirname(__FILE__).'/lib/rewrites.php'); + } - /** - * Creates the rewrite rules that the plugin needs to function - * @return void - */ - function create_rewrite_rules($rules) { - global $wp_rewrite; - $newRule = array('oauth/(.+)' => 'index.php?oauth='.$wp_rewrite->preg_index(1)); - $newRules = $newRule + $rules; - return $newRules; - } - /** - * Tell WordPress that we want to include "oauth" as something to look for in the permalinks - * @since 1.0.0 + * _load + * description will go here */ - function add_query_vars($qvars) { - $qvars[] = 'oauth'; - return $qvars; - } - + function _load(){ + + // @todo Tie in language file in the future + // load_plugin_textdomain('wpbu', false, basename( dirname( __FILE__ ) ) . '/languages'); + } + /** - * Flushes the permalink rules and resets them. - * This adds any new rules into the mix - * - * @since 1.0.0 + * _registerStyles + * Registers the plugin stylsheet + * @action wp_oauth2_styles */ - function flush_rewrite_rules() { - global $wp_rewrite; - $wp_rewrite->flush_rules(); - } - + function _registerStyles(){ + do_action('wp_oauth2_styles'); + wp_register_style( 'wp_oauth2_provider_stylesheet', plugins_url( '/lib/assets/css/layout.css') ); + } + /** - * Tells WordPress that when oauth is being called that we want stop and start using the OAuth2 Provider API hook - * - * @since 1.0.0 + * _adminMenu + * Sets the plugin admin menu */ - function template_redirect_intercept() { - - /** - * @global $wp_query Hooks into WordPress Queries - */ - global $wp_query; - - /** - * Check if "oauth" is found and is so than use OAuth2 Providers hook - * - * @since 1.0.0 - */ - if ($wp_query->get('oauth')) { - require_once(dirname(__FILE__). '/lib/classes/OAuth2_API.php'); - exit; - } - } - + function _adminMenu(){ + add_menu_page( 'WP OAuth2 Complete', 'Provider', 'manage_options', 'wp_oauth2_complete', 'wp_oauth2_complete_init_dashboard' ); + } + /** - * Creates a JSON output - * - * @since 1.0.0 - * @uses output - * @deprecated Generic Output. Not needed or used not more. Scheduled to be removed 1.0.1 + * _activate + * Contains the SQL bare bones when activating WP_OAuth2 */ - function pushoutput($message) { - $this->output($message); - } + function _activate(){ + + // Run a legacy upgrade first - This may be a life saver ;) + $this->_legacyupgrade(); + + // Used for gather the db prefix + global $wpdb; + + // OPTION TABLE + $install_options_table = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."oauth2_options ( + id INT NOT NULL AUTO_INCREMENT, + version VARCHAR(55) DEFAULT '' NOT NULL, + enabled INT(1) NOT NULL, + draft INT(1) NOT NULL, + UNIQUE KEY id (id) + );"; + + // CONSUMER TABLE + $install_auth_table = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."oauth2_auth_codes ( + code varchar(40) NOT NULL, + client_id varchar(40) NOT NULL, + user_id int(11) UNSIGNED NOT NULL, + redirect_uri varchar(200) NOT NULL, + expires int(11) NOT NULL, + scope varchar(255) DEFAULT NULL, + PRIMARY KEY (code) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; + + // CONSUMER NONCE TABLE + $install_clients_table = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."oauth2_clients ( + name varchar(40) NOT NULL, + client_id varchar(40) NOT NULL, + client_secret varchar(20) NOT NULL, + redirect_uri varchar(255) NOT NULL, + PRIMARY KEY (client_id) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; + + // TOKEN TABLE + $install_token_table = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."oauth2_access_tokens ( + oauth_token varchar(40) NOT NULL, + client_id varchar(40) NOT NULL, + user_id int(11) UNSIGNED NOT NULL, + expires int(11) NOT NULL, + scope varchar(255) DEFAULT NULL, + PRIMARY KEY (oauth_token) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; + + // TOKEN REFRESH TABLE + $install_refresh_token_table = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."oauth2_refresh_tokens ( + oauth_token varchar(40) NOT NULL, + client_id varchar(40) NOT NULL, + user_id int(11) UNSIGNED NOT NULL, + expires int(11) NOT NULL, + scope varchar(255) DEFAULT NULL, + PRIMARY KEY (oauth_token) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; - function output( $output ) { - header( 'Cache-Control: no-cache, must-revalidate' ); - header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); - - // Commented to display in browser. - // header( 'Content-type: application/json' ); - - echo json_encode( $output ); - } -} + + require_once( ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($install_options_table); + dbDelta($install_auth_table); + dbDelta($install_clients_table); + dbDelta($install_token_table); + dbDelta($install_refresh_token_table); -$OAuth2RewritesCode = new OAuth2Rewrites(); + } -/** - * Does not seem to be working like it should - * - * @todo Take this activation hook out and rewrite class - * @todo This is not working and will have to see why it is not flushing the rewrites properly - */ -register_activation_hook( __file__, array($OAuth2RewritesCode, 'activate') ); + /** + * _legacyupgrade + * Creates for pre existing tables form older installs so that data is not lost during upgrade from 1.x to verson 2.X + * @link http://dev.mysql.com/doc/refman/5.0/en/rename-table.html + * @todo Do this right. As of right now we are just supressing errors. If someone wants to make this right, be my guest but it works for me. + */ + function _legacyupgrade(){ + global $wpdb; + $wpdb->hide_errors(); + @$wpdb->query("RENAME TABLE oauth2_options TO {$wpdb->prefix}oauth2_options"); + @$wpdb->query("RENAME TABLE oauth2_auth_codes TO {$wpdb->prefix}oauth2_auth_codes"); + @$wpdb->query("RENAME TABLE oauth2_access_tokens TO {$wpdb->prefix}oauth2_access_tokens"); + @$wpdb->query("RENAME TABLE oauth2_refresh_tokens TO {$wpdb->prefix}oauth2_refresh_tokens"); + $wpdb->show_errors(); + } -/** - * Create all the hooks the link this all together with WordPress - */ -add_filter( 'rewrite_rules_array' , array($OAuth2RewritesCode , 'create_rewrite_rules' )); -add_filter( 'query_vars' , array($OAuth2RewritesCode , 'add_query_vars')); -add_filter( 'admin_init' , array($OAuth2RewritesCode , 'flush_rewrite_rules')); + /** + * _deactivate + * Not being used as of version 2.0.0 + */ + function _deactivate(){} -/** - * Add action hook to WordPress - * This was just added and seems to work pretty good - * - * @todo Look into this a little more clean layout and hook - */ -add_action( 'template_redirect', array($OAuth2RewritesCode, 'template_redirect_intercept') ); -?> \ No newline at end of file +} +$WP_OAuth = new WP_OAuth; +register_activation_hook(__FILE__, array( $WP_OAuth, '_activate')); \ No newline at end of file