From 5f1609577e7ae229f05d0b6a65a92b7a276dc3a3 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 31 Mar 2013 13:57:24 +0100 Subject: [PATCH] Added stateParamRequired method --- src/OAuth2/AuthServer.php | 10 ++++++++++ src/OAuth2/Grant/AuthCode.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/OAuth2/AuthServer.php b/src/OAuth2/AuthServer.php index fcae8a1f..d357c0ff 100644 --- a/src/OAuth2/AuthServer.php +++ b/src/OAuth2/AuthServer.php @@ -306,6 +306,16 @@ class AuthServer return $this->defaultScope; } + /** + * Require the "state" paremter in checkAuthoriseParams() + * @param boolean $require + * @return void + */ + public function stateParamRequired() + { + return $this->requireStateParam; + } + /** * Require the "state" paremter in checkAuthoriseParams() * @param boolean $require diff --git a/src/OAuth2/Grant/AuthCode.php b/src/OAuth2/Grant/AuthCode.php index acae346a..3b2d400d 100644 --- a/src/OAuth2/Grant/AuthCode.php +++ b/src/OAuth2/Grant/AuthCode.php @@ -90,7 +90,7 @@ class AuthCode implements GrantTypeInterface { throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'redirect_uri'), 0); } - if ($this->authServer->scopeParamRequired() === true && is_null($authParams['state'])) { + if ($this->authServer->stateParamRequired() === true && is_null($authParams['state'])) { throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'state'), 0); }