mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16955] Clean up auth classes
PHPBB3-16955
This commit is contained in:
parent
5756d4dd9b
commit
eeeb69b4ae
5 changed files with 24 additions and 36 deletions
|
@ -23,7 +23,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +30,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function autologin()
|
public function autologin()
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +37,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function acp()
|
public function acp()
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +44,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function get_acp_template($new_config)
|
public function get_acp_template($new_config)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +51,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function get_login_data()
|
public function get_login_data()
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +58,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function get_auth_link_data($user_id = 0)
|
public function get_auth_link_data($user_id = 0)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +65,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function logout($data, $new_session)
|
public function logout($data, $new_session)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +72,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function validate_session($user)
|
public function validate_session($user)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,7 +79,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function login_link_has_necessary_data(array $login_link_data)
|
public function login_link_has_necessary_data(array $login_link_data)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,7 +86,6 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function link_account(array $link_data)
|
public function link_account(array $link_data)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,6 +93,5 @@ abstract class base implements provider_interface
|
||||||
*/
|
*/
|
||||||
public function unlink_account(array $link_data)
|
public function unlink_account(array $link_data)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,7 @@ class oauth extends base
|
||||||
* @var ServiceInterface service OAuth service
|
* @var ServiceInterface service OAuth service
|
||||||
* @since 3.2.3-RC1
|
* @since 3.2.3-RC1
|
||||||
* @changed 3.2.6-RC1 Added redirect_data
|
* @changed 3.2.6-RC1 Added redirect_data
|
||||||
|
* @psalm-var string[] $vars
|
||||||
*/
|
*/
|
||||||
$vars = [
|
$vars = [
|
||||||
'row',
|
'row',
|
||||||
|
@ -423,8 +424,6 @@ class oauth extends base
|
||||||
{
|
{
|
||||||
return 'LOGIN_LINK_MISSING_DATA';
|
return 'LOGIN_LINK_MISSING_DATA';
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -618,8 +617,8 @@ class oauth extends base
|
||||||
* @param array $link_data The same variable given to
|
* @param array $link_data The same variable given to
|
||||||
* {@see \phpbb\auth\provider\provider_interface::link_account}
|
* {@see \phpbb\auth\provider\provider_interface::link_account}
|
||||||
* @param string $service_name The name of the service being used in linking.
|
* @param string $service_name The name of the service being used in linking.
|
||||||
* @return string|false Returns a language constant (string) if an error is encountered,
|
* @return array|string|false Returns a language constant (string) if an error is encountered,
|
||||||
* or false on success.
|
* an array with error info or false on success.
|
||||||
*/
|
*/
|
||||||
protected function link_account_auth_link(array $link_data, $service_name)
|
protected function link_account_auth_link(array $link_data, $service_name)
|
||||||
{
|
{
|
||||||
|
@ -828,8 +827,8 @@ class oauth extends base
|
||||||
* Sets a redirect to the authorization uri.
|
* Sets a redirect to the authorization uri.
|
||||||
*
|
*
|
||||||
* @param OAuth1Service|OAuth2Service $service The external OAuth service
|
* @param OAuth1Service|OAuth2Service $service The external OAuth service
|
||||||
* @return array|false Array if an error occurred,
|
* @return array Array if an error occurred,
|
||||||
* false on success
|
* won't return on success
|
||||||
*/
|
*/
|
||||||
protected function set_redirect($service)
|
protected function set_redirect($service)
|
||||||
{
|
{
|
||||||
|
@ -854,6 +853,6 @@ class oauth extends base
|
||||||
|
|
||||||
redirect($service->getAuthorizationUri($parameters), false, true);
|
redirect($service->getAuthorizationUri($parameters), false, true);
|
||||||
|
|
||||||
return false;
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ class token_storage implements TokenStorageInterface
|
||||||
$data['session_id'] = $this->user->data['session_id'];
|
$data['session_id'] = $this->user->data['session_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->get_state_row($data);
|
return $this->get_state_row($data)['oauth_state'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,8 +25,8 @@ interface provider_interface
|
||||||
* Changing to an authentication provider will not be permitted in acp_board
|
* Changing to an authentication provider will not be permitted in acp_board
|
||||||
* if there is an error.
|
* if there is an error.
|
||||||
*
|
*
|
||||||
* @return boolean|string False if the user is identified, otherwise an
|
* @return bool|string|void False if the user is identified, otherwise an
|
||||||
* error message, or null if not implemented.
|
* error message, or void if not implemented.
|
||||||
*/
|
*/
|
||||||
public function init();
|
public function init();
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ interface provider_interface
|
||||||
/**
|
/**
|
||||||
* Autologin function
|
* Autologin function
|
||||||
*
|
*
|
||||||
* @return array|null containing the user row, empty if no auto login
|
* @return array|void containing the user row, empty if no auto login
|
||||||
* should take place, or null if not implemented.
|
* should take place, or void if not implemented.
|
||||||
*/
|
*/
|
||||||
public function autologin();
|
public function autologin();
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ interface provider_interface
|
||||||
* This function is used to output any required fields in the authentication
|
* This function is used to output any required fields in the authentication
|
||||||
* admin panel. It also defines any required configuration table fields.
|
* admin panel. It also defines any required configuration table fields.
|
||||||
*
|
*
|
||||||
* @return array|null Returns null if not implemented or an array of the
|
* @return array|void Returns void if not implemented or an array of the
|
||||||
* configuration fields of the provider.
|
* configuration fields of the provider.
|
||||||
*/
|
*/
|
||||||
public function acp();
|
public function acp();
|
||||||
|
@ -74,7 +74,7 @@ interface provider_interface
|
||||||
*
|
*
|
||||||
* @param \phpbb\config\config $new_config Contains the new configuration values
|
* @param \phpbb\config\config $new_config Contains the new configuration values
|
||||||
* that have been set in acp_board.
|
* that have been set in acp_board.
|
||||||
* @return array|null Returns null if not implemented or an array with
|
* @return array|void Returns void if not implemented or an array with
|
||||||
* the template file name and an array of the vars
|
* the template file name and an array of the vars
|
||||||
* that the template needs that must conform to the
|
* that the template needs that must conform to the
|
||||||
* following example:
|
* following example:
|
||||||
|
@ -107,8 +107,8 @@ interface provider_interface
|
||||||
* Returns an array of data necessary to build custom elements on the login
|
* Returns an array of data necessary to build custom elements on the login
|
||||||
* form.
|
* form.
|
||||||
*
|
*
|
||||||
* @return array|null If this function is not implemented on an auth
|
* @return array|void If this function is not implemented on an auth
|
||||||
* provider then it returns null. If it is implemented
|
* provider then it returns void. If it is implemented
|
||||||
* it will return an array of up to four elements of
|
* it will return an array of up to four elements of
|
||||||
* which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
|
* which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
|
||||||
* present then 'BLOCK_VARS' must also be present in
|
* present then 'BLOCK_VARS' must also be present in
|
||||||
|
@ -139,8 +139,8 @@ interface provider_interface
|
||||||
* into phpBB.
|
* into phpBB.
|
||||||
*
|
*
|
||||||
* @param array $user
|
* @param array $user
|
||||||
* @return boolean true if the given user is authenticated, false if the
|
* @return bool|void true if the given user is authenticated, false if the
|
||||||
* session should be closed, or null if not implemented.
|
* session should be closed, or void if not implemented.
|
||||||
*/
|
*/
|
||||||
public function validate_session($user);
|
public function validate_session($user);
|
||||||
|
|
||||||
|
@ -151,8 +151,8 @@ interface provider_interface
|
||||||
*
|
*
|
||||||
* @param array $login_link_data Any data needed to link a phpBB account to
|
* @param array $login_link_data Any data needed to link a phpBB account to
|
||||||
* an external account.
|
* an external account.
|
||||||
* @return string|null Returns a string with a language constant if there
|
* @return string|void Returns a string with a language constant if there
|
||||||
* is data missing or null if there is no error.
|
* is data missing or void if there is no error.
|
||||||
*/
|
*/
|
||||||
public function login_link_has_necessary_data(array $login_link_data);
|
public function login_link_has_necessary_data(array $login_link_data);
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ interface provider_interface
|
||||||
* defaults to 0, which is not a valid ID. The method
|
* defaults to 0, which is not a valid ID. The method
|
||||||
* should fall back to the current user's ID in this
|
* should fall back to the current user's ID in this
|
||||||
* case.
|
* case.
|
||||||
* @return array|null If this function is not implemented on an auth
|
* @return array|void If this function is not implemented on an auth
|
||||||
* provider then it returns null. If it is implemented
|
* provider then it returns void. If it is implemented
|
||||||
* it will return an array of up to four elements of
|
* it will return an array of up to four elements of
|
||||||
* which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
|
* which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
|
||||||
* present then 'BLOCK_VARS' must also be present in
|
* present then 'BLOCK_VARS' must also be present in
|
||||||
|
|
|
@ -571,7 +571,7 @@ abstract class driver implements driver_interface
|
||||||
*/
|
*/
|
||||||
function sql_build_array($query, $assoc_ary = [])
|
function sql_build_array($query, $assoc_ary = [])
|
||||||
{
|
{
|
||||||
if (!count($assoc_ary))
|
if (!is_array($assoc_ary) || !count($assoc_ary))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue