Added an console command to convert local to SAML users and vice versa

This commit is contained in:
Jan Böhmer 2023-02-23 23:36:40 +01:00
parent c5904303e3
commit c831d57614
5 changed files with 165 additions and 4 deletions

View file

@ -26,12 +26,14 @@ use Symfony\Component\Security\Core\User\UserInterface;
class SamlUserFactory implements SamlUserFactoryInterface
{
public const SAML_PASSWORD_PLACEHOLDER = '!!SAML!!';
public function createUser($username, array $attributes = []): UserInterface
{
$user = new User();
$user->setName($username);
$user->setNeedPwChange(false);
$user->setPassword('!!SAML!!');
$user->setPassword(self::SAML_PASSWORD_PLACEHOLDER);
//This is a SAML user now!
$user->setSamlUser(true);