Commit 34869394 authored by Mat's avatar Mat

Le token est d'abord décodé par le service lettreToken

parent 50957a7c
......@@ -32,9 +32,6 @@
<p>{{ body.groupe.nom }}<br>
{{ body.depot.localisation }}</p>
{% for i in body.lettre.sorted %}
{{ i }}
{% endfor %}
{{ dump() }}
......
......@@ -3,6 +3,7 @@
namespace PotageBundle\Security;
use PotageBundle\Services\LettreToken;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
......@@ -15,6 +16,19 @@ use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
class TokenAuthenticator extends AbstractGuardAuthenticator
{
private $lettreToken;
/**
* TokenAuthenticator constructor.
*
* @param LettreToken $lettreToken
*/
public function __construct(LettreToken $lettreToken)
{
$this->lettreToken = $lettreToken;
}
/**
* Called on every request to decide if this authenticator should be
* used for the request. Returning false will cause this authenticator
......@@ -81,8 +95,11 @@ class TokenAuthenticator extends AbstractGuardAuthenticator
*/
public function getCredentials(Request $request)
{
$tokenEncoded = $request->query->get('token');
$inToken = $this->lettreToken->decodePotageAccess($tokenEncoded);
return array(
'token' => $request->query->get('token'),
'token' => $inToken['user_token'],
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment