forked from mautic/mautic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Firewall implementation for SAML SSO support; some user information i…
…s hacked in that still needs to be addressed
- Loading branch information
1 parent
ac36238
commit 9217eaa
Showing
9 changed files
with
1,510 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
<?php | ||
/** | ||
* @package Mautic | ||
* @copyright 2014 Mautic Contributors. All rights reserved. | ||
* @copyright 2014 Mautic Contributors. All rights reserved | ||
* @author Mautic | ||
* | ||
* @link http://mautic.org | ||
* | ||
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html | ||
*/ | ||
|
||
namespace Mautic\UserBundle\Security\User; | ||
|
||
use Mautic\UserBundle\Entity\User; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
use Doctrine\ORM\EntityManager; | ||
use LightSaml\Model\Protocol\Response; | ||
use LightSaml\SpBundle\Security\User\UserCreatorInterface; | ||
use LightSaml\SpBundle\Security\User\UsernameMapperInterface; | ||
use Mautic\UserBundle\Entity\User; | ||
use Symfony\Component\Security\Core\User\UserInterface; | ||
|
||
class UserCreator implements UserCreatorInterface | ||
{ | ||
/** @var ObjectManager */ | ||
private $objectManager; | ||
/** @var EntityManager */ | ||
private $entityManager; | ||
|
||
/** @var UsernameMapperInterface */ | ||
private $usernameMapper; | ||
|
||
/** | ||
* @param ObjectManager $objectManager | ||
* @param EntityManager $entityManager | ||
* @param UsernameMapperInterface $usernameMapper | ||
*/ | ||
public function __construct($objectManager, $usernameMapper) | ||
public function __construct($entityManager, $usernameMapper) | ||
{ | ||
$this->objectManager = $objectManager; | ||
$this->entityManager = $entityManager; | ||
$this->usernameMapper = $usernameMapper; | ||
} | ||
|
||
|
@@ -43,14 +45,16 @@ public function createUser(Response $response) | |
$username = $this->usernameMapper->getUsername($response); | ||
|
||
$user = new User(); | ||
$user | ||
->setUsername($username) | ||
->setRoles(['ROLE_USER']) | ||
; | ||
$user->setUsername($username) | ||
->setFirstName('Saml') | ||
->setLastName('Saml') | ||
->setPassword(1234) | ||
->setEmail('[email protected]') | ||
->setRole($this->entityManager->getReference('MauticUserBundle:Role', 1)); | ||
|
||
$this->objectManager->persist($user); | ||
$this->objectManager->flush(); | ||
$this->entityManager->persist($user); | ||
$this->entityManager->flush(); | ||
|
||
return $user; | ||
} | ||
} | ||
} |
Oops, something went wrong.