public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
 {
     /* your code here */
     $this->auth->authenticate();
     /* your code here */
     $token = (new Parser())->parse();
     $user = $this->auth->getUser($token->getClaim('email'));
     if (!$user instanceof User) {
         /* your code here */
     }
     $request = $request->withAttribute('user', $user);
     $response = $next($request, $response);
     return $response;
 }
 /**
  * @When /I authenticate using the (.+) token/
  */
 public function iAuthenticateUsingCustomToken($token)
 {
     $this->execute(function () use($token) {
         $this->library->authenticate($token);
     });
 }