added support for saml login (#1408)
This commit is contained in:
@@ -181,6 +181,46 @@ class ConfigurationTest extends TestCase
|
||||
$this->assertConfig($config, []);
|
||||
}
|
||||
|
||||
public function testValidateSamlIsMissingMappingForEmail()
|
||||
{
|
||||
$this->expectException(InvalidConfigurationException::class);
|
||||
$this->expectExceptionMessage('Invalid configuration for path "kimai.saml": You need to configure a SAML mapping for the email attribute.');
|
||||
|
||||
$config = $this->getMinConfig();
|
||||
$config['saml'] = [
|
||||
'activate' => true,
|
||||
'mapping' => [],
|
||||
];
|
||||
|
||||
$this->assertConfig($config, []);
|
||||
}
|
||||
|
||||
public function testValidateSamlDoesNotTriggerOnDeactivatedSaml()
|
||||
{
|
||||
$finalizedConfig = $this->getCompiledConfig($this->getMinConfig());
|
||||
$config = $this->getMinConfig();
|
||||
$config['saml'] = [
|
||||
'activate' => false,
|
||||
'mapping' => [],
|
||||
];
|
||||
|
||||
$this->assertConfig($config, $finalizedConfig);
|
||||
}
|
||||
|
||||
public function testValidateSamlDoesNotTriggerWhenEmailMappingExists()
|
||||
{
|
||||
$config = $this->getMinConfig();
|
||||
$config['saml'] = [
|
||||
'activate' => true,
|
||||
'mapping' => [
|
||||
['saml' => 'email', 'kimai' => 'email']
|
||||
],
|
||||
];
|
||||
$finalizedConfig = $this->getCompiledConfig($config);
|
||||
|
||||
$this->assertConfig($config, $finalizedConfig);
|
||||
}
|
||||
|
||||
public function testDefaultLdapSettings()
|
||||
{
|
||||
$finalizedConfig = $this->getCompiledConfig($this->getMinConfig());
|
||||
@@ -349,6 +389,18 @@ class ConfigurationTest extends TestCase
|
||||
'userDnAttribute' => 'member',
|
||||
'groups' => [],
|
||||
],
|
||||
],
|
||||
'saml' => [
|
||||
'activate' => false,
|
||||
'title' => 'Login with SAML',
|
||||
'roles' => [
|
||||
'attribute' => null,
|
||||
'mapping' => []
|
||||
],
|
||||
'mapping' => [],
|
||||
'connection' => [
|
||||
'organization' => []
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user