Rename authentication type "autologin" to "external"

refs #8274
This commit is contained in:
Johannes Meyer 2015-01-27 09:49:36 +01:00
parent 0fa133abfb
commit 50fc85d7ff
9 changed files with 31 additions and 31 deletions

View File

@ -1,5 +1,5 @@
[autologin]
backend = autologin
backend = external
[icingaweb-mysql]
backend = db

View File

@ -8,16 +8,16 @@ use Zend_Validate_Callback;
use Icinga\Web\Form;
/**
* Form class for adding/modifying autologin authentication backends
* Form class for adding/modifying authentication backends of type "external"
*/
class AutologinBackendForm extends Form
class ExternalBackendForm extends Form
{
/**
* Initialize this form
*/
public function init()
{
$this->setName('form_config_authbackend_autologin');
$this->setName('form_config_authbackend_external');
}
/**
@ -69,7 +69,7 @@ class AutologinBackendForm extends Form
'backend',
array(
'disabled' => true,
'value' => 'autologin'
'value' => 'external'
)
);
@ -79,7 +79,7 @@ class AutologinBackendForm extends Form
/**
* Validate the configuration by creating a backend and requesting the user count
*
* Returns always true as autologin backends are just "passive" backends. (The webserver authenticates users.)
* Returns always true as backends of type "external" are just "passive" backends.
*
* @param Form $form The form to fetch the configuration values from
*

View File

@ -14,7 +14,7 @@ use Icinga\Data\ResourceFactory;
use Icinga\Exception\ConfigurationError;
use Icinga\Forms\Config\Authentication\DbBackendForm;
use Icinga\Forms\Config\Authentication\LdapBackendForm;
use Icinga\Forms\Config\Authentication\AutologinBackendForm;
use Icinga\Forms\Config\Authentication\ExternalBackendForm;
class AuthenticationBackendConfigForm extends ConfigForm
{
@ -67,8 +67,8 @@ class AuthenticationBackendConfigForm extends ConfigForm
} elseif ($type === 'ldap') {
$form = new LdapBackendForm();
$form->setResources(isset($this->resources['ldap']) ? $this->resources['ldap'] : array());
} elseif ($type === 'autologin') {
$form = new AutologinBackendForm();
} elseif ($type === 'external') {
$form = new ExternalBackendForm();
} else {
throw new InvalidArgumentException(sprintf($this->translate('Invalid backend type "%s" provided'), $type));
}
@ -251,14 +251,14 @@ class AuthenticationBackendConfigForm extends ConfigForm
$configValues['name'] = $authBackend;
$this->populate($configValues);
} elseif (empty($this->resources)) {
$autologinBackends = array_filter(
$externalBackends = array_filter(
$this->config->toArray(),
function ($authBackendCfg) {
return isset($authBackendCfg['backend']) && $authBackendCfg['backend'] === 'autologin';
return isset($authBackendCfg['backend']) && $authBackendCfg['backend'] === 'external';
}
);
if (false === empty($autologinBackends)) {
if (false === empty($externalBackends)) {
throw new ConfigurationError($this->translate('Could not find any resources for authentication'));
}
}
@ -299,14 +299,14 @@ class AuthenticationBackendConfigForm extends ConfigForm
$backendTypes['ldap'] = 'LDAP';
}
$autologinBackends = array_filter(
$externalBackends = array_filter(
$this->config->toArray(),
function ($authBackendCfg) {
return isset($authBackendCfg['backend']) && $authBackendCfg['backend'] === 'autologin';
return isset($authBackendCfg['backend']) && $authBackendCfg['backend'] === 'external';
}
);
if ($backendType === 'autologin' || empty($autologinBackends)) {
$backendTypes['autologin'] = $this->translate('Autologin');
if ($backendType === 'external' || empty($externalBackends)) {
$backendTypes['external'] = $this->translate('External');
}
if ($backendType === null) {

View File

@ -24,7 +24,7 @@ For delegating authentication to the web server simply add `autologin` to your a
````
[autologin]
backend = autologin
backend = external
````
If your web server is not configured for authentication though the `autologin` section has no effect.

View File

@ -11,7 +11,7 @@ use Icinga\User;
/**
* Test login with external authentication mechanism, e.g. Apache
*/
class AutoLoginBackend extends UserBackend
class ExternalBackend extends UserBackend
{
/**
* Regexp expression to strip values from a username
@ -21,7 +21,7 @@ class AutoLoginBackend extends UserBackend
private $stripUsernameRegexp;
/**
* Create new autologin backend
* Create new authentication backend of type "external"
*
* @param ConfigObject $config
*/
@ -33,7 +33,7 @@ class AutoLoginBackend extends UserBackend
/**
* Count the available users
*
* Autologin backends will always return 1
* Authenticaton backends of type "external" will always return 1
*
* @return int
*/

View File

@ -5,7 +5,7 @@
namespace Icinga\Authentication;
use Countable;
use Icinga\Authentication\Backend\AutoLoginBackend;
use Icinga\Authentication\Backend\ExternalBackend;
use Icinga\Authentication\Backend\DbUserBackend;
use Icinga\Authentication\Backend\LdapUserBackend;
use Icinga\Data\ConfigObject;
@ -69,8 +69,8 @@ abstract class UserBackend implements Countable
);
}
$backendType = strtolower($backendType);
if ($backendType === 'autologin') {
$backend = new AutoLoginBackend($backendConfig);
if ($backendType === 'external') {
$backend = new ExternalBackend($backendConfig);
$backend->setName($name);
return $backend;
}

View File

@ -7,7 +7,7 @@ namespace Icinga\Module\Setup\Forms;
use Icinga\Web\Form;
use Icinga\Forms\Config\Authentication\DbBackendForm;
use Icinga\Forms\Config\Authentication\LdapBackendForm;
use Icinga\Forms\Config\Authentication\AutologinBackendForm;
use Icinga\Forms\Config\Authentication\ExternalBackendForm;
use Icinga\Data\ConfigObject;
/**
@ -80,7 +80,7 @@ class AuthBackendPage extends Form
'Before you are able to authenticate using the LDAP connection defined earlier you need to'
. ' provide some more information so that Icinga Web 2 is able to locate account details.'
);
} else { // if ($this->config['type'] === 'autologin'
} else { // if ($this->config['type'] === 'external'
$note = $this->translate(
'You\'ve chosen to authenticate using a web server\'s mechanism so it may be necessary'
. ' to adjust usernames before any permissions, restrictions, etc. are being applied.'
@ -103,8 +103,8 @@ class AuthBackendPage extends Form
} elseif ($this->config['type'] === 'ldap') {
$backendForm = new LdapBackendForm();
$backendForm->createElements($formData)->removeElement('resource');
} else { // $this->config['type'] === 'autologin'
$backendForm = new AutologinBackendForm();
} else { // $this->config['type'] === 'external'
$backendForm = new ExternalBackendForm();
$backendForm->createElements($formData);
}

View File

@ -37,10 +37,10 @@ class AuthenticationPage extends Form
)
);
if (isset($formData['type']) && $formData['type'] === 'autologin' && !isset($_SERVER['REMOTE_USER'])) {
if (isset($formData['type']) && $formData['type'] === 'external' && !isset($_SERVER['REMOTE_USER'])) {
$this->addElement(
'note',
'autologin_note',
'external_note',
array(
'value' => sprintf(
$this->translate(
@ -80,7 +80,7 @@ class AuthenticationPage extends Form
if (Platform::extensionLoaded('ldap')) {
$backendTypes['ldap'] = 'LDAP';
}
$backendTypes['autologin'] = $this->translate('Autologin');
$backendTypes['external'] = $this->translate('External');
$this->addElement(
'select',

View File

@ -139,7 +139,7 @@ class AuthenticationStep extends Step
. '<td><strong>' . t('User Name Attribute') . '</strong></td>'
. '<td>' . $this->data['backendConfig']['user_name_attribute'] . '</td>'
. '</tr>'
) : ($authType === 'autologin' ? (
) : ($authType === 'external' ? (
'<tr>'
. '<td><strong>' . t('Filter Pattern') . '</strong></td>'
. '<td>' . $this->data['backendConfig']['strip_username_regexp'] . '</td>'