Hi,
I go by description, I did create own User Factory that implements SamlUserFactoryInterface.
In method createUser, I dump user, and I see him with all attributes that i get from IdP. But I am still (infinity) redirect to IdP. Symfony 5.3. Pls help.
SamlUserCreator.php:
namespace App\Security;
use App\Entity\User;
use Hslavich\OneloginSamlBundle\Security\Authentication\Token\SamlTokenInterface;
use Hslavich\OneloginSamlBundle\Security\User\SamlUserFactoryInterface;
use Symfony\Component\Security\Core\User\UserInterface;
class SAMLUserCreator implements SamlUserFactoryInterface
{
public function createUser($username, array $attributes = []): UserInterface
{
if (is_string($username)) {
$idpAttributes = $attributes;
} else {
$idpAttributes = $username->getAttributes();
}
$user = new User();
$user->setRoles(unserialize($idpAttributes["roles"][0]));
$user->setId($idpAttributes["id"][0]);
$user->setUsername($idpAttributes["name"][0]);
$user->setSurname($idpAttributes["surname"][0]);
$user->setEmail($idpAttributes["email"][0]);
$user->setPassword($idpAttributes["password"][0]);
//var_dump($user); die(); - when dump is disabled, still redirecting
return $user;
}
}
Hi, I did fix it. It was my bug. It crashed on isEqualTo method in user class. I make own isEqualTo method with own conditions, and seems it works now.
Hi, I go by description, I did create own User Factory that implements SamlUserFactoryInterface. In method createUser, I dump user, and I see him with all attributes that i get from IdP. But I am still (infinity) redirect to IdP. Symfony 5.3. Pls help.
SamlUserCreator.php:
security.yaml:
services.yaml