added support for saml login (#1408)

This commit is contained in:
Kevin Papst
2020-01-31 19:47:34 +01:00
committed by GitHub
parent 3ff46e06c0
commit 6a533579b7
47 changed files with 2278 additions and 77 deletions

View File

@@ -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' => []
],
]
];