Add token entities

This commit is contained in:
Romain Neutron
2014-02-28 01:59:00 +01:00
parent d3bf3f747e
commit 8b6cb53a36
61 changed files with 1442 additions and 758 deletions

View File

@@ -10,8 +10,9 @@
*/
use Alchemy\Phrasea\Application;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Manipulator\TokenManipulator;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class API_OAuth2_Application
{
@@ -606,8 +607,8 @@ class API_OAuth2_Application
)';
$nonce = $app['random.medium']->generateString(64);
$client_secret = $app['random.medium']->generateString(32, \random::LETTERS_AND_NUMBERS);
$client_token = $app['random.medium']->generateString(32, \random::LETTERS_AND_NUMBERS);
$client_secret = $app['random.medium']->generateString(32, TokenManipulator::LETTERS_AND_NUMBERS);
$client_token = $app['random.medium']->generateString(32, TokenManipulator::LETTERS_AND_NUMBERS);
$params = [
':usr_id' => $user ? $user->getId() : null,

View File

@@ -10,6 +10,7 @@
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Manipulator\TokenManipulator;
use RandomLib\Generator;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -230,7 +231,7 @@ class API_OAuth2_Token
$sql = 'UPDATE api_oauth_tokens SET oauth_token = :new_token
WHERE oauth_token = :old_token';
$new_token = $this->generator->generateString(32, \random::LETTERS_AND_NUMBERS);
$new_token = $this->generator->generateString(32, TokenManipulator::LETTERS_AND_NUMBERS);
$params = [
':new_token' => $new_token
@@ -303,7 +304,7 @@ class API_OAuth2_Token
$expires = new \DateTime('+1 hour');
$params = [
':token' => $generator->generateString(32, \random::LETTERS_AND_NUMBERS)
':token' => $generator->generateString(32, TokenManipulator::LETTERS_AND_NUMBERS)
, ':account_id' => $account->get_id()
, ':expire' => $expires->format(DATE_ISO8601)
, ':scope' => $scope