state param for AbstractProvider::getAuthorizationUrl()

1.0
Matus Zeman 2014-11-26 14:57:23 +01:00
parent b747fdde54
commit ce1915643c
2 changed files with 9 additions and 1 deletions

View File

@ -85,7 +85,7 @@ abstract class AbstractProvider implements ProviderInterface
public function getAuthorizationUrl($options = array())
{
$this->state = md5(uniqid(rand(), true));
$this->state = isset($options['state']) ? $options['state'] : md5(uniqid(rand(), true));
$params = array(
'client_id' => $this->clientId,

View File

@ -33,4 +33,12 @@ class AbstractProviderTest extends \PHPUnit_Framework_TestCase
$grant = new \StdClass;
$this->provider->getAccessToken($grant, array('invalid_parameter' => 'none'));
}
public function testAuthorizationUrlStateParam()
{
$this->assertContains('state=XXX', $this->provider->getAuthorizationUrl([
'state' => 'XXX'
]));
}
}