diff --git a/UPDATE.md b/UPDATE.md index 54d339d237..1d08d5854f 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -21,6 +21,9 @@ PR12 to PR13 $container->removeDefinition('my_definition'); $definition->replaceArgument(0, 'foo'); + +* In the rememberme configuration, the token_provider key now expects a real + service id instead of only a suffix. PR11 to PR12 ------------ diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php index 21f1ee1bc3..13cf66fa39 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php @@ -35,9 +35,6 @@ class RememberMeFactory implements SecurityFactoryInterface // remember me services if (isset($config['token_provider'])) { - $config['token-provider'] = $config['token_provider']; - } - if (isset($config['token-provider'])) { $templateId = 'security.authentication.rememberme.services.persistent'; $rememberMeServicesId = $templateId.'.'.$id; } else { @@ -56,10 +53,9 @@ class RememberMeFactory implements SecurityFactoryInterface $rememberMeServices->replaceArgument(1, $config['key']); $rememberMeServices->replaceArgument(2, $id); - if (isset($config['token-provider'])) { - // FIXME: make the naming assumption more flexible + if (isset($config['token_provider'])) { $rememberMeServices->addMethodCall('setTokenProvider', array( - new Reference('security.rememberme.token.provider.'.$config['token-provider']) + new Reference($config['token_provider']) )); } diff --git a/src/Symfony/Component/Security/Acl/Domain/Acl.php b/src/Symfony/Component/Security/Acl/Domain/Acl.php index 20f300b539..09bcb34390 100644 --- a/src/Symfony/Component/Security/Acl/Domain/Acl.php +++ b/src/Symfony/Component/Security/Acl/Domain/Acl.php @@ -10,6 +10,7 @@ namespace Symfony\Component\Security\Acl\Domain; +use Doctrine\Common\NotifyPropertyChanged; use Doctrine\Common\PropertyChangedListener; use Symfony\Component\Security\Acl\Model\AclInterface; use Symfony\Component\Security\Acl\Model\AuditableAclInterface; @@ -33,7 +34,7 @@ use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface; * * @author Johannes M. Schmitt */ -class Acl implements AuditableAclInterface +class Acl implements AuditableAclInterface, NotifyPropertyChanged { private $parentAcl; private $permissionGrantingStrategy; diff --git a/src/Symfony/Component/Security/Acl/Domain/FieldEntry.php b/src/Symfony/Component/Security/Acl/Domain/FieldEntry.php index 0f71237831..1510df2411 100644 --- a/src/Symfony/Component/Security/Acl/Domain/FieldEntry.php +++ b/src/Symfony/Component/Security/Acl/Domain/FieldEntry.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Security\Acl\Domain; use Symfony\Component\Security\Acl\Model\AclInterface; -use Symfony\Component\Security\Acl\Model\FieldAwareEntryInterface; +use Symfony\Component\Security\Acl\Model\FieldEntryInterface; use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface; /** @@ -20,7 +20,7 @@ use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface; * * @author Johannes M. Schmitt */ -class FieldEntry extends Entry implements FieldAwareEntryInterface +class FieldEntry extends Entry implements FieldEntryInterface { private $field; diff --git a/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php b/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php index 8bee157ae4..37bbe4eb0f 100644 --- a/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php +++ b/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php @@ -30,16 +30,8 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface const ALL = 'all'; const ANY = 'any'; - private static $noAceException; private $auditLogger; - public function __construct() - { - if (null === static::$noAceException) { - static::$noAceException = new NoAceFoundException('No ACE.'); - } - } - /** * Sets the audit logger * @@ -61,7 +53,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface $aces = $acl->getObjectAces(); if (!$aces) { - throw static::$noAceException; + throw new NoAceFoundException(); } return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); @@ -69,7 +61,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface $aces = $acl->getClassAces(); if (!$aces) { - throw static::$noAceException; + throw $noObjectAce; } return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); @@ -79,7 +71,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface return $parentAcl->isGranted($masks, $sids, $administrativeMode); } - throw new NoAceFoundException('No applicable ACE was found.'); + throw $noClassAce; } } @@ -92,14 +84,14 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface try { $aces = $acl->getObjectFieldAces($field); if (!$aces) { - throw static::$noAceException; + throw new NoAceFoundException(); } return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); } catch (NoAceFoundException $noObjectAces) { $aces = $acl->getClassFieldAces($field); if (!$aces) { - throw static::$noAceException; + throw $noObjectAces; } return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); @@ -109,7 +101,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface return $parentAcl->isFieldGranted($field, $masks, $sids, $administrativeMode); } - throw new NoAceFoundException('No applicable ACE was found.'); + throw $noClassAces; } } @@ -177,7 +169,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface return false; } - throw static::$noAceException; + throw new NoAceFoundException(); } /** diff --git a/src/Symfony/Component/Security/Acl/Exception/NoAceFoundException.php b/src/Symfony/Component/Security/Acl/Exception/NoAceFoundException.php index 0ecad61349..994efc012b 100644 --- a/src/Symfony/Component/Security/Acl/Exception/NoAceFoundException.php +++ b/src/Symfony/Component/Security/Acl/Exception/NoAceFoundException.php @@ -19,4 +19,8 @@ namespace Symfony\Component\Security\Acl\Exception; */ class NoAceFoundException extends Exception { + public function __construct() + { + parent::__construct('No applicable ACE was found.'); + } } \ No newline at end of file diff --git a/src/Symfony/Component/Security/Acl/Model/FieldAwareEntryInterface.php b/src/Symfony/Component/Security/Acl/Model/FieldEntryInterface.php similarity index 91% rename from src/Symfony/Component/Security/Acl/Model/FieldAwareEntryInterface.php rename to src/Symfony/Component/Security/Acl/Model/FieldEntryInterface.php index bcf292cdaf..68aa10c9f1 100644 --- a/src/Symfony/Component/Security/Acl/Model/FieldAwareEntryInterface.php +++ b/src/Symfony/Component/Security/Acl/Model/FieldEntryInterface.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Security\Acl\Model; * * @author Johannes M. Schmitt */ -interface FieldAwareEntryInterface +interface FieldEntryInterface extends EntryInterface { /** * Returns the field used for this entry. diff --git a/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php b/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php index 4e52e65cef..fdd671236b 100644 --- a/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php +++ b/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Security\Acl\Model; -use Doctrine\Common\NotifyPropertyChanged; - /** * This interface adds mutators for the AclInterface. * @@ -21,7 +19,7 @@ use Doctrine\Common\NotifyPropertyChanged; * * @author Johannes M. Schmitt */ -interface MutableAclInterface extends AclInterface, NotifyPropertyChanged +interface MutableAclInterface extends AclInterface { /** * Deletes a class-based ACE diff --git a/src/Symfony/Component/Security/Core/SecurityContextInterface.php b/src/Symfony/Component/Security/Core/SecurityContextInterface.php index a47c89dbcb..c54ca0e3c9 100644 --- a/src/Symfony/Component/Security/Core/SecurityContextInterface.php +++ b/src/Symfony/Component/Security/Core/SecurityContextInterface.php @@ -28,7 +28,7 @@ interface SecurityContextInterface * @param TokenInterface $token * @return void */ - function setToken(TokenInterface $token); + function setToken(TokenInterface $token = null); /** * Checks if the attributes are granted against the current authentication token and optionally supplied object.