Skip to content

Instantly share code, notes, and snippets.

@havvg
Created April 20, 2012 14:37
Show Gist options
  • Save havvg/2429133 to your computer and use it in GitHub Desktop.
Save havvg/2429133 to your computer and use it in GitHub Desktop.
Symfony2 Propel Security Update
diff --git a/app/config/security.yml b/app/config/security.yml
index 336f4d8..b346131 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -1,6 +1,6 @@
security:
encoders:
- Ormigo\Bundle\ReportingBundle\Security\UserProxy:
+ Ormigo\Bundle\ReportingBundle\Model\User:
algorithm: sha512
encode_as_base64: true
iterations: 5000
@@ -10,8 +10,10 @@ security:
ROLE_SUPER_ADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
providers:
- propel:
- id: ormigo.security.user_provider
+ main:
+ propel:
+ class: Ormigo\Bundle\ReportingBundle\Model\User
+ property: username
firewalls:
dev:
diff --git a/deps.lock b/deps.lock
index 6eab3a5..7f6eab9 100644
--- a/deps.lock
+++ b/deps.lock
@@ -1,12 +1,12 @@
-symfony f8407dd2cc8f55531a4795db13fde371ae7e1d04
+symfony ae6ccfa94b41340be524ddcc76f411d1163ccdab
twig 037f86aa550737abf633e991f3606b9de5a69657
monolog d348b2c2529f8468ba27189b99d4eed247ebac7c
MonologBundle aea0145e5669ed855db430e0f53536fab16b6dd7
assetic 3acfb6afa50dd1dca387a8dfb641cd3b98a8584d
AsseticBundle d370e914e86518e88aa00ab266796ee032b8262e
phing 1fd92c78f14a02b3e1cd9c59c7a08b4cab532d33
propel 3d68575d18ab628371b3e6a4d51419e05c297e23
-PropelBundle fb1e679f45883f2172d26f05cf2620894b0c043a
+PropelBundle 341ee674affc1160e4d026877bf8a3de20ce694b
KnpMenu ad10e1ec8f493bb29e28c02284f38c5afd4bfa07
KnpMenuBundle c20933d2b988a3bd0944a0fd9e00068c30f0d27f
TwitterBootstrap 6506ede6323ee60d4d7f8171937d92141a64e09e
diff --git a/src/Ormigo/Bundle/ReportingBundle/Model/User.php b/src/Ormigo/Bundle/ReportingBundle/Model/User.php
index 0c8bd14..4666482 100644
--- a/src/Ormigo/Bundle/ReportingBundle/Model/User.php
+++ b/src/Ormigo/Bundle/ReportingBundle/Model/User.php
@@ -4,7 +4,20 @@ namespace Ormigo\Bundle\ReportingBundle\Model;
use Ormigo\Bundle\ReportingBundle\Model\om\BaseUser;
-class User extends BaseUser
-{
+use Symfony\Component\Security\Core\User\UserInterface;
+class User extends BaseUser implements UserInterface
+{
+ /**
+ * Removes sensitive data from the user.
+ *
+ * This is important if, at any given point, sensitive information like
+ * the plain-text password is stored on this object.
+ *
+ * @return void
+ */
+ public function eraseCredentials()
+ {
+ // Nothing to do here.
+ }
}
diff --git a/src/Ormigo/Bundle/ReportingBundle/Resources/config/services.yml b/src/Ormigo/Bundle/ReportingBundle/Resources/config/services.yml
index 60ff8ca..334c9b8 100644
--- a/src/Ormigo/Bundle/ReportingBundle/Resources/config/services.yml
+++ b/src/Ormigo/Bundle/ReportingBundle/Resources/config/services.yml
@@ -1,7 +1,4 @@
services:
- ormigo.security.user_provider:
- class: Ormigo\Bundle\ReportingBundle\Security\UserProvider
-
reportings.navbar:
class: %mopa_bootstrap.navbar.generic%
scope: request
diff --git a/src/Ormigo/Bundle/ReportingBundle/Security/UserProvider.php b/src/Ormigo/Bundle/ReportingBundle/Security/UserProvider.php
deleted file mode 100644
index 3311011..0000000
--- a/src/Ormigo/Bundle/ReportingBundle/Security/UserProvider.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-namespace Ormigo\Bundle\ReportingBundle\Security;
-
-use Propel\PropelBundle\Security\User\ModelUserProvider;
-
-class UserProvider extends ModelUserProvider
-{
- public function __construct()
- {
- parent::__construct('Ormigo\Bundle\ReportingBundle\Model\User', 'Ormigo\Bundle\ReportingBundle\Security\UserProxy', 'username');
- }
-}
\ No newline at end of file
diff --git a/src/Ormigo/Bundle/ReportingBundle/Security/UserProxy.php b/src/Ormigo/Bundle/ReportingBundle/Security/UserProxy.php
deleted file mode 100644
index 17b1f64..0000000
--- a/src/Ormigo/Bundle/ReportingBundle/Security/UserProxy.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-namespace Ormigo\Bundle\ReportingBundle\Security;
-
-use Symfony\Component\Security\Core\User\UserInterface;
-use Ormigo\Bundle\ReportingBundle\Model\User;
-
-class UserProxy implements UserInterface
-{
- /**
- * The model user
- *
- * @var \Acme\BlogBundle\Model\User
- */
- protected $user;
-
- public function __construct(User $user)
- {
- $this->user = $user;
- }
-
- public function getRoles()
- {
- return $this->getUser()->getRoles();
- }
-
- public function getPassword()
- {
- return $this->getUser()->getPassword();
- }
-
- public function getSalt()
- {
- return $this->getUser()->getSalt();
- }
-
- public function getUsername()
- {
- return $this->getUser()->getUsername();
- }
-
- public function eraseCredentials()
- {
- // Nothing to do with that user model.
- }
-
- public function equals(UserInterface $user)
- {
- return $this->getUser()->getUsername() === $user->getUsername();
- }
-
- public function getPrimaryKey()
- {
- return $this->getUser()->getPrimaryKey();
- }
-
- /**
- * @return \Acme\BlogBundle\Model\User
- */
- protected function getUser()
- {
- return $this->user;
- }
-}
\ No newline at end of file
diff --git a/vendor/bundles/Propel/PropelBundle b/vendor/bundles/Propel/PropelBundle
index fb1e679..341ee67 160000
--- a/vendor/bundles/Propel/PropelBundle
+++ b/vendor/bundles/Propel/PropelBundle
@@ -1 +1 @@
-Subproject commit fb1e679f45883f2172d26f05cf2620894b0c043a
+Subproject commit 341ee674affc1160e4d026877bf8a3de20ce694b
diff --git a/vendor/symfony b/vendor/symfony
index f8407dd..ae6ccfa 160000
--- a/vendor/symfony
+++ b/vendor/symfony
@@ -1 +1 @@
-Subproject commit f8407dd2cc8f55531a4795db13fde371ae7e1d04
+Subproject commit ae6ccfa94b41340be524ddcc76f411d1163ccdab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment