2.0 release candidate (#3808)

* use SAML interface instead of implementation
* moved implementation of SAML configs to system-configuration base class
* bump composer packages
* simplify configuration for different env
This commit is contained in:
Kevin Papst
2023-02-02 00:45:50 +01:00
committed by GitHub
parent 5711c15eac
commit 63a3ae1147
21 changed files with 272 additions and 395 deletions

View File

@@ -9,9 +9,6 @@
namespace App\Configuration;
/**
* @CloudRequired
*/
final class SamlConfiguration implements SamlConfigurationInterface
{
public function __construct(private SystemConfiguration $configuration)
@@ -35,22 +32,17 @@ final class SamlConfiguration implements SamlConfigurationInterface
public function getAttributeMapping(): array
{
return $this->configuration->findArray('saml.mapping');
return $this->configuration->getSamlAttributeMapping();
}
public function getRolesAttribute(): ?string
{
$attr = $this->configuration->find('saml.roles.attribute');
if (empty($attr)) {
return null;
}
return (string) $attr;
return $this->configuration->getSamlRolesAttribute();
}
public function getRolesMapping(): array
{
return $this->configuration->findArray('saml.roles.mapping');
return $this->configuration->getSamlRolesMapping();
}
public function isRolesResetOnLogin(): bool
@@ -60,6 +52,6 @@ final class SamlConfiguration implements SamlConfigurationInterface
public function getConnection(): array
{
return $this->configuration->findArray('saml.connection');
return $this->configuration->getSamlConnection();
}
}

View File

@@ -9,12 +9,32 @@
namespace App\Configuration;
/**
* @CloudRequired
*/
interface SamlConfigurationInterface
{
/**
* Whether SAML login is activated.
*
* @return bool
*/
public function isActivated(): bool;
/**
* Returns the title that is exclusively used in the frontend.
* Currently, used to display the button in the login screen.
*
* @return string
*/
public function getTitle(): string;
/**
* Returns the provider name that is exclusively used in the frontend.
* Currently, used to display an icon in the login screen.
*
* @return string
*/
public function getProvider(): string;
public function getAttributeMapping(): array;

View File

@@ -218,6 +218,40 @@ final class SystemConfiguration
return (bool) $this->find('saml.roles.resetOnLogin');
}
/**
* @return array<mixed>
*/
public function getSamlRolesMapping(): array
{
return $this->findArray('saml.roles.mapping');
}
/**
* @return array<mixed>
*/
public function getSamlConnection(): array
{
return $this->findArray('saml.connection');
}
/**
* @return array<mixed>
*/
public function getSamlAttributeMapping(): array
{
return $this->findArray('saml.mapping');
}
public function getSamlRolesAttribute(): ?string
{
$attr = $this->find('saml.roles.attribute');
if (empty($attr)) {
return null;
}
return (string) $attr;
}
public function isLdapActive(): bool
{
return (bool) $this->find('ldap.activate');