summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--Core/Exception/AccessDeniedException.php35
-rw-r--r--Core/composer.json2
-rw-r--r--Csrf/composer.json2
-rw-r--r--Guard/composer.json2
-rw-r--r--Http/Firewall/AccessListener.php6
-rw-r--r--Http/Firewall/SwitchUserListener.php5
-rw-r--r--Http/composer.json4
-rw-r--r--composer.json2
9 files changed, 55 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 107ed1d..f92742a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========
+3.2.0
+-----
+
+ * added `attributes` and `object` with getters/setters to `Symfony\Component\Security\Core\Exception\AccessDeniedException`
+
3.0.0
-----
diff --git a/Core/Exception/AccessDeniedException.php b/Core/Exception/AccessDeniedException.php
index 736a36b..d9a7019 100644
--- a/Core/Exception/AccessDeniedException.php
+++ b/Core/Exception/AccessDeniedException.php
@@ -18,8 +18,43 @@ namespace Symfony\Component\Security\Core\Exception;
*/
class AccessDeniedException extends \RuntimeException
{
+ private $attributes = array();
+ private $object;
+
public function __construct($message = 'Access Denied.', \Exception $previous = null)
{
parent::__construct($message, 403, $previous);
}
+
+ /**
+ * @return array
+ */
+ public function getAttributes()
+ {
+ return $this->attributes;
+ }
+
+ /**
+ * @param array|string $attributes
+ */
+ public function setAttributes($attributes)
+ {
+ $this->attributes = (array) $attributes;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getObject()
+ {
+ return $this->object;
+ }
+
+ /**
+ * @param mixed $object
+ */
+ public function setObject($object)
+ {
+ $this->object = $object;
+ }
}
diff --git a/Core/composer.json b/Core/composer.json
index e2915b0..25cc061 100644
--- a/Core/composer.json
+++ b/Core/composer.json
@@ -44,7 +44,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.1-dev"
+ "dev-master": "3.2-dev"
}
}
}
diff --git a/Csrf/composer.json b/Csrf/composer.json
index d111fa1..4047fd5 100644
--- a/Csrf/composer.json
+++ b/Csrf/composer.json
@@ -36,7 +36,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.1-dev"
+ "dev-master": "3.2-dev"
}
}
}
diff --git a/Guard/composer.json b/Guard/composer.json
index 7adb774..4980923 100644
--- a/Guard/composer.json
+++ b/Guard/composer.json
@@ -32,7 +32,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.1-dev"
+ "dev-master": "3.2-dev"
}
}
}
diff --git a/Http/Firewall/AccessListener.php b/Http/Firewall/AccessListener.php
index c234317..5a23666 100644
--- a/Http/Firewall/AccessListener.php
+++ b/Http/Firewall/AccessListener.php
@@ -67,7 +67,11 @@ class AccessListener implements ListenerInterface
}
if (!$this->accessDecisionManager->decide($token, $attributes, $request)) {
- throw new AccessDeniedException();
+ $exception = new AccessDeniedException();
+ $exception->setAttributes($attributes);
+ $exception->setObject($request);
+
+ throw $exception;
}
}
}
diff --git a/Http/Firewall/SwitchUserListener.php b/Http/Firewall/SwitchUserListener.php
index 7de83d2..e9c3e40 100644
--- a/Http/Firewall/SwitchUserListener.php
+++ b/Http/Firewall/SwitchUserListener.php
@@ -122,7 +122,10 @@ class SwitchUserListener implements ListenerInterface
}
if (false === $this->accessDecisionManager->decide($token, array($this->role))) {
- throw new AccessDeniedException();
+ $exception = new AccessDeniedException();
+ $exception->setAttributes($this->role);
+
+ throw $exception;
}
$username = $request->get($this->usernameParameter);
diff --git a/Http/composer.json b/Http/composer.json
index f19d0e4..add5d3a 100644
--- a/Http/composer.json
+++ b/Http/composer.json
@@ -17,7 +17,7 @@
],
"require": {
"php": ">=5.5.9",
- "symfony/security-core": "~2.8|~3.0",
+ "symfony/security-core": "~3.2",
"symfony/event-dispatcher": "~2.8|~3.0",
"symfony/http-foundation": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0",
@@ -43,7 +43,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.1-dev"
+ "dev-master": "3.2-dev"
}
}
}
diff --git a/composer.json b/composer.json
index 7b3801f..430ea54 100644
--- a/composer.json
+++ b/composer.json
@@ -56,7 +56,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.1-dev"
+ "dev-master": "3.2-dev"
}
}
}