Making use of the configuration class instead of require_once
git-svn-id: http://simplesamlphp.googlecode.com/svn/trunk@494 44740490-163a-0410-bde0-09ae8108e29a
This commit is contained in:
parent
2edc9a7cbe
commit
9be54844dd
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/*
|
||||
* The configuration of the login-auto authentication module.
|
||||
*
|
||||
* $Id: config.php 451 2008-03-27 15:33:34Z olavmrk $
|
||||
*/
|
||||
|
||||
$config = array (
|
||||
|
||||
/*
|
||||
* This option enables or disables the login-auto authentication
|
||||
* handler. This handler is implemented in 'www/auth/login-auto.php'.
|
||||
*
|
||||
* When this option is set to true, a user can go to the
|
||||
* 'auth/login-auto.php' web page to be authenticated as an example
|
||||
* user. The user will receive the attributes set in the
|
||||
* 'auth.auto.attributes' option.
|
||||
*
|
||||
* WARNING: setting this option to true will make it possible to use
|
||||
* this authenticator for all users, irrespectively of the 'auth'
|
||||
* setting in the IdP's metadata. They can always use it by opening the
|
||||
* 'auth/login-auto.php' webpage manually.
|
||||
*/
|
||||
'auth.auto.enable' => true,
|
||||
|
||||
/*
|
||||
* This option configures which attributes the login-auto
|
||||
* authentication handler will set for the user. It is an array of
|
||||
* arrays. The name of the attribute is the index in the first array,
|
||||
* and all the values for the attribute is given in the array
|
||||
* referenced to by the name.
|
||||
*
|
||||
* Example:
|
||||
* 'auth.auto.attributes' => array(
|
||||
* 'edupersonaffiliation' => array('student', 'member'),
|
||||
* 'uid' => array('example_uid'),
|
||||
* 'mail' => array('example@example.com'),
|
||||
* ),
|
||||
*/
|
||||
'auth.auto.attributes' => array(
|
||||
'edupersonaffiliation' => array('student', 'member'),
|
||||
'title' => array('Example user title'),
|
||||
'uid' => array('example_uid'),
|
||||
'mail' => array('example@example.com'),
|
||||
'cn' => array('Example user commonname'),
|
||||
'givenname' => array('Example user givenname'),
|
||||
'sn' => array("Example surname"),
|
||||
),
|
||||
|
||||
/*
|
||||
* When this option is set to true, the login-auto authentication
|
||||
* handler will ask for a username and a password. This can be used to
|
||||
* test the IdP. The username and password isn't verified, and the
|
||||
* user/script can enter anything.
|
||||
*/
|
||||
'auth.auto.ask_login' => false,
|
||||
|
||||
/*
|
||||
* This option configures a delay in the login-auto authentication
|
||||
* handler. The script will wait for the given number of milliseconds
|
||||
* before authenticating the user. This can, for example, be used in
|
||||
* a simple simulation of a slow LDAP server.
|
||||
*/
|
||||
'auth.auto.delay_login' => 0,
|
||||
);
|
||||
|
||||
|
||||
?>
|
|
@ -334,62 +334,6 @@ $config = array (
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* This option enables or disables the login-auto authentication
|
||||
* handler. This handler is implemented in 'www/auth/login-auto.php'.
|
||||
*
|
||||
* When this option is set to true, a user can go to the
|
||||
* 'auth/login-auto.php' web page to be authenticated as an example
|
||||
* user. The user will receive the attributes set in the
|
||||
* 'auth.auto.attributes' option.
|
||||
*
|
||||
* WARNING: setting this option to true will make it possible to use
|
||||
* this authenticator for all users, irrespectively of the 'auth'
|
||||
* setting in the IdP's metadata. They can always use it by opening the
|
||||
* 'auth/login-auto.php' webpage manually.
|
||||
*/
|
||||
'auth.auto.enable' => false,
|
||||
|
||||
/*
|
||||
* This option configures which attributes the login-auto
|
||||
* authentication handler will set for the user. It is an array of
|
||||
* arrays. The name of the attribute is the index in the first array,
|
||||
* and all the values for the attribute is given in the array
|
||||
* referenced to by the name.
|
||||
*
|
||||
* Example:
|
||||
* 'auth.auto.attributes' => array(
|
||||
* 'edupersonaffiliation' => array('student', 'member'),
|
||||
* 'uid' => array('example_uid'),
|
||||
* 'mail' => array('example@example.com'),
|
||||
* ),
|
||||
*/
|
||||
'auth.auto.attributes' => array(
|
||||
'edupersonaffiliation' => array('student', 'member'),
|
||||
'title' => array('Example user title'),
|
||||
'uid' => array('example_uid'),
|
||||
'mail' => array('example@example.com'),
|
||||
'cn' => array('Example user commonname'),
|
||||
'givenname' => array('Example user givenname'),
|
||||
'sn' => array("Example surname"),
|
||||
),
|
||||
|
||||
/*
|
||||
* When this option is set to true, the login-auto authentication
|
||||
* handler will ask for a username and a password. This can be used to
|
||||
* test the IdP. The username and password isn't verified, and the
|
||||
* user/script can enter anything.
|
||||
*/
|
||||
'auth.auto.ask_login' => false,
|
||||
|
||||
/*
|
||||
* This option configures a delay in the login-auto authentication
|
||||
* handler. The script will wait for the given number of milliseconds
|
||||
* before authenticating the user. This can, for example, be used in
|
||||
* a simple simulation of a slow LDAP server.
|
||||
*/
|
||||
'auth.auto.delay_login' => 0,
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -26,10 +26,13 @@ require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSA
|
|||
|
||||
/* Load the configuration. */
|
||||
$config = SimpleSAML_Configuration::getInstance();
|
||||
$enable = (bool)$config->getValue('auth.auto.enable');
|
||||
$attributes = $config->getValue('auth.auto.attributes');
|
||||
$ask_login = (bool)$config->getValue('auth.auto.ask_login');
|
||||
$delay_login = (int)$config->getValue('auth.auto.delay_login');
|
||||
$autoconfig = $config->copyFromBase('loginauto', 'config-login-auto.php');
|
||||
|
||||
|
||||
$enable = (bool)$autoconfig->getValue('auth.auto.enable');
|
||||
$attributes = $autoconfig->getValue('auth.auto.attributes');
|
||||
$ask_login = (bool)$autoconfig->getValue('auth.auto.ask_login');
|
||||
$delay_login = (int)$autoconfig->getValue('auth.auto.delay_login');
|
||||
|
||||
/* Verify that this authentication handler is enabled. */
|
||||
if(!$enable) {
|
||||
|
|
Reference in New Issue