From 49a5d99ec575a068c5062344457cdbbd42739d23 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Mon, 17 Jun 2013 16:35:06 -0400 Subject: [feature/auth-refactor] Auth Apache Provider Skeleton Creates a skeleton for Apache based authentication using the phpbb_auth_provider_interface named phpbb_auth_provider_apache. This brings over all code in auth_apache.php verbatim complete with all global variables currently in use. PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 265 ++++++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 phpBB/includes/auth/provider_apache.php (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php new file mode 100644 index 0000000000..ca3bf41560 --- /dev/null +++ b/phpBB/includes/auth/provider_apache.php @@ -0,0 +1,265 @@ +is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $user->data['username'] !== htmlspecialchars_decode($request->server('PHP_AUTH_USER'))) + { + return $user->lang['APACHE_SETUP_BEFORE_USE']; + } + return false; + } + + /** + * Login function + */ + public function login(&$username, &$password) + { + global $db, $request; + + // do not allow empty password + if (!$password) + { + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'NO_PASSWORD_SUPPLIED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $php_auth_user = htmlspecialchars_decode($request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($request->server('PHP_AUTH_PW')); + + if (!empty($php_auth_user) && !empty($php_auth_pw)) + { + if ($php_auth_user !== $username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type + FROM ' . USERS_TABLE . " + WHERE username = '" . $db->sql_escape($php_auth_user) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + // User inactive... + if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) + { + return array( + 'status' => LOGIN_ERROR_ACTIVE, + 'error_msg' => 'ACTIVE_ERROR', + 'user_row' => $row, + ); + } + + // Successful login... + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + + // this is the user's first login so create an empty profile + return array( + 'status' => LOGIN_SUCCESS_CREATE_PROFILE, + 'error_msg' => false, + 'user_row' => user_row_apache($php_auth_user, $php_auth_pw), + ); + } + + // Not logged into apache + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + /** + * Autologin function + * + * @return array containing the user row or empty if no auto login should + * take place + */ + public function autologin() + { + global $db, $request; + + if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + { + return array(); + } + + $php_auth_user = htmlspecialchars_decode($request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($request->server('PHP_AUTH_PW')); + + if (!empty($php_auth_user) && !empty($php_auth_pw)) + { + set_var($php_auth_user, $php_auth_user, 'string', true); + set_var($php_auth_pw, $php_auth_pw, 'string', true); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username = '" . $db->sql_escape($php_auth_user) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row; + } + + if (!function_exists('user_add')) + { + global $phpbb_root_path, $phpEx; + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + // create the user if he does not exist yet + user_add(user_row_apache($php_auth_user, $php_auth_pw)); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($php_auth_user)) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return $row; + } + } + + return array(); + } + + /** + * This function generates an array which can be passed to the user_add + * function in order to create a user + * + * @param str $username The username of the new user. + * @param str $password The password of the new user. + * @return array Contains data that can be passed directly to + * the user_add function. + */ + private function user_row($username, $password) + { + global $db, $config, $user; + // first retrieve default group id + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + // generate user account data + return array( + 'username' => $username, + 'user_password' => phpbb_hash($password), + 'user_email' => '', + 'group_id' => (int) $row['group_id'], + 'user_type' => USER_NORMAL, + 'user_ip' => $user->ip, + 'user_new' => ($config['new_member_post_limit']) ? 1 : 0, + ); + } + + /** + * The session validation function checks whether the user is still logged in + * + * @return boolean true if the given user is authenticated or false if + * the session should be closed + */ + public function validate_session(&$user) + { + global $request; + + // Check if PHP_AUTH_USER is set and handle this case + if ($request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + { + $php_auth_user = $request->server('PHP_AUTH_USER'); + + return ($php_auth_user === $user['username']) ? true : false; + } + + // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not) + if ($user['user_type'] == USER_IGNORE) + { + return true; + } + + return false; + } + + public function acp() + { + return; + } +} -- cgit v1.2.1 From db27a8c67a9730384a912298a85a7bf38e506d7d Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Tue, 18 Jun 2013 15:32:18 -0400 Subject: [feature/auth-refactor] Fix comment block indentation Comment block indentation was off by one space on the provider_* files due to being incorrectly copied over from the auth_* files. PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index ca3bf41560..bb25e502a6 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -23,12 +23,12 @@ if (!defined('IN_PHPBB')) class phpbb_auth_provider_apache implements phpbb_auth_provider_interface { /** - * Checks whether the user is identified to apache - * Only allow changing authentication to apache if the user is identified - * Called in acp_board while setting authentication plugins - * - * @return boolean|string false if the user is identified and else an error message - */ + * Checks whether the user is identified to apache + * Only allow changing authentication to apache if the user is identified + * Called in acp_board while setting authentication plugins + * + * @return boolean|string false if the user is identified and else an error message + */ public function init() { global $user, $request; @@ -41,8 +41,8 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface } /** - * Login function - */ + * Login function + */ public function login(&$username, &$password) { global $db, $request; @@ -133,11 +133,11 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface } /** - * Autologin function - * - * @return array containing the user row or empty if no auto login should - * take place - */ + * Autologin function + * + * @return array containing the user row or empty if no auto login should + * take place + */ public function autologin() { global $db, $request; @@ -194,14 +194,14 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface } /** - * This function generates an array which can be passed to the user_add - * function in order to create a user - * - * @param str $username The username of the new user. - * @param str $password The password of the new user. - * @return array Contains data that can be passed directly to - * the user_add function. - */ + * This function generates an array which can be passed to the user_add + * function in order to create a user + * + * @param str $username The username of the new user. + * @param str $password The password of the new user. + * @return array Contains data that can be passed directly to + * the user_add function. + */ private function user_row($username, $password) { global $db, $config, $user; @@ -232,11 +232,11 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface } /** - * The session validation function checks whether the user is still logged in - * - * @return boolean true if the given user is authenticated or false if - * the session should be closed - */ + * The session validation function checks whether the user is still logged in + * + * @return boolean true if the given user is authenticated or false if + * the session should be closed + */ public function validate_session(&$user) { global $request; -- cgit v1.2.1 From 57689948e252ef3240b2c20be95923d6a0635ca9 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Tue, 18 Jun 2013 15:39:51 -0400 Subject: [feature/auth-refactor] Make Apache consistent with interface Makes the provider_apache consistent with the provider_interface by removing the pass-by-reference of $username and $password. PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index bb25e502a6..01aa9400fd 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -43,7 +43,7 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface /** * Login function */ - public function login(&$username, &$password) + public function login($username, $password) { global $db, $request; -- cgit v1.2.1 From 553c300688818c36acc4d579762b3eb428d27321 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Wed, 19 Jun 2013 14:20:29 -0400 Subject: [feature/auth-refactor] Fix typos causing changes to not work Replaces short tags with long tags. Fixes the interface to be an interface and not class in the file. Removes unnecessary include_once from auth.php. PHPBB-9734 --- phpBB/includes/auth/provider_apache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index 01aa9400fd..a923fb4265 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -1,4 +1,4 @@ - Date: Wed, 19 Jun 2013 14:57:11 -0400 Subject: [feature/auth-refactor] Refactor acp_board for new auth interface Partially refactors acp_board for the new authentication interface. Leaves some questionable if statements in the file. Modifies the interface to correctly impletment the acp() method. Modifies each provider to comply with the above mentioned interface modification. PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index a923fb4265..2d26b85877 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -258,7 +258,7 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface return false; } - public function acp() + public function acp($new) { return; } -- cgit v1.2.1 From 8214e6e8377b0858092e48aba3ba2a01994be47f Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Wed, 19 Jun 2013 15:32:20 -0400 Subject: [feature/auth-refactor] Finish refactoring auth plugins I believe that this commit should have final minimal changes needed to replace the old auth plugins with the refactored auth plugins. Added a few more elements to the interface based on the old auth plugins. Documentation is not complete and need works on these new elements. PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index 2d26b85877..2ba76e26a9 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -237,7 +237,7 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface * @return boolean true if the given user is authenticated or false if * the session should be closed */ - public function validate_session(&$user) + public function validate_session($user) { global $request; @@ -262,4 +262,9 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface { return; } + + public function logout($data, $new_session) + { + return; + } } -- cgit v1.2.1 From c9062fc1ee9bade7c2b4d84c99b3b71a78d5570c Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 20 Jun 2013 22:21:22 -0400 Subject: [feature/auth-refactor] Convert provider_apache to a service Removes globals from provider_apache and turns it into a service. PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 89 ++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 40 deletions(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index 2ba76e26a9..adb1fb6cea 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -22,6 +22,26 @@ if (!defined('IN_PHPBB')) */ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface { + /** + * Apache Authentication Constructor + * + * @param phpbb_db_driver $db + * @param phpbb_config $config + * @param phpbb_request $request + * @param phpbb_user $user + * @param string $phpbb_root_path + * @param string $phpEx + */ + public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $phpEx) + { + $this->db = $db; + $this->config = $config; + $this->request = $request; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + } + /** * Checks whether the user is identified to apache * Only allow changing authentication to apache if the user is identified @@ -31,11 +51,9 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface */ public function init() { - global $user, $request; - - if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $user->data['username'] !== htmlspecialchars_decode($request->server('PHP_AUTH_USER'))) + if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) { - return $user->lang['APACHE_SETUP_BEFORE_USE']; + return $this->user->lang['APACHE_SETUP_BEFORE_USE']; } return false; } @@ -45,8 +63,6 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface */ public function login($username, $password) { - global $db, $request; - // do not allow empty password if (!$password) { @@ -66,7 +82,7 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface ); } - if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) { return array( 'status' => LOGIN_ERROR_EXTERNAL_AUTH, @@ -75,8 +91,8 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface ); } - $php_auth_user = htmlspecialchars_decode($request->server('PHP_AUTH_USER')); - $php_auth_pw = htmlspecialchars_decode($request->server('PHP_AUTH_PW')); + $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW')); if (!empty($php_auth_user) && !empty($php_auth_pw)) { @@ -91,10 +107,10 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type FROM ' . USERS_TABLE . " - WHERE username = '" . $db->sql_escape($php_auth_user) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); if ($row) { @@ -140,15 +156,13 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface */ public function autologin() { - global $db, $request; - - if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) { return array(); } - $php_auth_user = htmlspecialchars_decode($request->server('PHP_AUTH_USER')); - $php_auth_pw = htmlspecialchars_decode($request->server('PHP_AUTH_PW')); + $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW')); if (!empty($php_auth_user) && !empty($php_auth_pw)) { @@ -157,10 +171,10 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface $sql = 'SELECT * FROM ' . USERS_TABLE . " - WHERE username = '" . $db->sql_escape($php_auth_user) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); if ($row) { @@ -169,9 +183,7 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface if (!function_exists('user_add')) { - global $phpbb_root_path, $phpEx; - - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx); } // create the user if he does not exist yet @@ -179,10 +191,10 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface $sql = 'SELECT * FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($php_auth_user)) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($php_auth_user)) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); if ($row) { @@ -204,15 +216,14 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface */ private function user_row($username, $password) { - global $db, $config, $user; // first retrieve default group id $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " - WHERE group_name = '" . $db->sql_escape('REGISTERED') . "' + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' AND group_type = " . GROUP_SPECIAL; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); if (!$row) { @@ -226,8 +237,8 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface 'user_email' => '', 'group_id' => (int) $row['group_id'], 'user_type' => USER_NORMAL, - 'user_ip' => $user->ip, - 'user_new' => ($config['new_member_post_limit']) ? 1 : 0, + 'user_ip' => $this->user->ip, + 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0, ); } @@ -239,12 +250,10 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface */ public function validate_session($user) { - global $request; - // Check if PHP_AUTH_USER is set and handle this case - if ($request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + if ($this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) { - $php_auth_user = $request->server('PHP_AUTH_USER'); + $php_auth_user = $this->request->server('PHP_AUTH_USER'); return ($php_auth_user === $user['username']) ? true : false; } -- cgit v1.2.1 From 5af7d2b07f788f6795865225612175b65c596a4b Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Wed, 26 Jun 2013 21:45:16 -0400 Subject: [feature/auth-refactor] Change phpEx to php_ext in new classes PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index adb1fb6cea..0a6811bbcb 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -30,16 +30,16 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface * @param phpbb_request $request * @param phpbb_user $user * @param string $phpbb_root_path - * @param string $phpEx + * @param string $php_ext */ - public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $phpEx) + public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; $this->request = $request; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; } /** @@ -183,7 +183,7 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface if (!function_exists('user_add')) { - include($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); } // create the user if he does not exist yet -- cgit v1.2.1 From 24e323d59353810293dea41d6b9b4114dd627543 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 27 Jun 2013 14:17:29 -0400 Subject: [feature/auth-refactor] Finish and clean up documentation PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index 0a6811bbcb..054316db19 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -42,13 +42,6 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface $this->php_ext = $php_ext; } - /** - * Checks whether the user is identified to apache - * Only allow changing authentication to apache if the user is identified - * Called in acp_board while setting authentication plugins - * - * @return boolean|string false if the user is identified and else an error message - */ public function init() { if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) @@ -58,9 +51,6 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface return false; } - /** - * Login function - */ public function login($username, $password) { // do not allow empty password @@ -148,12 +138,6 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface ); } - /** - * Autologin function - * - * @return array containing the user row or empty if no auto login should - * take place - */ public function autologin() { if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) @@ -209,8 +193,8 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface * This function generates an array which can be passed to the user_add * function in order to create a user * - * @param str $username The username of the new user. - * @param str $password The password of the new user. + * @param string $username The username of the new user. + * @param string $password The password of the new user. * @return array Contains data that can be passed directly to * the user_add function. */ @@ -242,12 +226,6 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface ); } - /** - * The session validation function checks whether the user is still logged in - * - * @return boolean true if the given user is authenticated or false if - * the session should be closed - */ public function validate_session($user) { // Check if PHP_AUTH_USER is set and handle this case -- cgit v1.2.1 From 27f0b9ff4359a60f98533aff2a87c1848d622d4c Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Fri, 28 Jun 2013 13:43:41 -0400 Subject: [feature/auth-refactor] Forgot @inheritdoc on methods PHPBB3-9734 --- phpBB/includes/auth/provider_apache.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'phpBB/includes/auth/provider_apache.php') diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider_apache.php index 054316db19..5f6f2862b6 100644 --- a/phpBB/includes/auth/provider_apache.php +++ b/phpBB/includes/auth/provider_apache.php @@ -42,6 +42,9 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface $this->php_ext = $php_ext; } + /** + * {@inheritdoc} + */ public function init() { if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) @@ -51,6 +54,9 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface return false; } + /** + * {@inheritdoc} + */ public function login($username, $password) { // do not allow empty password @@ -138,6 +144,9 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface ); } + /** + * {@inheritdoc} + */ public function autologin() { if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) @@ -226,6 +235,9 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface ); } + /** + * {@inheritdoc} + */ public function validate_session($user) { // Check if PHP_AUTH_USER is set and handle this case @@ -245,11 +257,17 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface return false; } + /** + * {@inheritdoc} + */ public function acp($new) { return; } + /** + * {@inheritdoc} + */ public function logout($data, $new_session) { return; -- cgit v1.2.1