Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function onAuthenticationSuccess(Request $request, TokenInterface $token)
 {
     $apiToken = $this->getToken($request);
     $history = new ApiTokenHistory();
     $history->setMethod($request->getMethod())->setIp($request->getClientIp())->setRequestData($request->request->all())->setUserAgent($request->server->get('HTTP_USER_AGENT'))->setResource($request->getPathInfo());
     /** @var ApiTokenHistoryRepository $repository */
     $repository = $this->registry->getRepository('CSBillUserBundle:ApiTokenHistory');
     $repository->addHistory($history, $apiToken);
 }
Esempio n. 2
0
 /**
  * @param ApiTokenHistory $history
  *
  * @return ApiToken
  */
 public function addHistory(ApiTokenHistory $history)
 {
     $this->history[] = $history;
     $history->setToken($this);
     return $this;
 }