Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration with fosuserbundle #105

Open
anthonyav opened this issue Nov 16, 2015 · 0 comments
Open

integration with fosuserbundle #105

anthonyav opened this issue Nov 16, 2015 · 0 comments

Comments

@anthonyav
Copy link

I try to integrate the bundle samlspbundle on a project running with fosuserbundle.

I actually received information from my idp which send me the saml with the email address of the user.

What i'm trying to do is load the user from my table fosuser and then authenticate it.

this is the method i am in my model SamlToUser :

private function loadUserByTargetedID($targetedID)
{
$repository = $this->container->get('doctrine')->getManager()->getRepository('MCCAppBDDBundle:User');

$user = $repository->findOneBy(
    array('email' => $targetedID)
);

if ($user) {
    $userManager = $this->container->get('fos_user.user_manager');

    $url = $this->container->get('router')->generate('homepage');
    $response = new RedirectResponse($url);

    $this->container->get('fos_user.security.login_manager')->loginUser(
        $this->container->getParameter('fos_user.firewall_name'),
        $user,
        null
    );

    $userManager->updateUser($user);

    return $user;
}

throw new \Symfony\Component\Security\Core\Exception\UsernameNotFoundException();

}
After that i have this error : PHP Warning: session_regenerate_id(): Cannot regenerate session id - headers already sent

I'm not sure is the right thing to do.

If you need other detail, i can give you.

Thanks to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant