当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthenticationException::getMessageData方法代码示例

本文整理汇总了PHP中Symfony\Component\Security\Core\Exception\AuthenticationException::getMessageData方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthenticationException::getMessageData方法的具体用法?PHP AuthenticationException::getMessageData怎么用?PHP AuthenticationException::getMessageData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Security\Core\Exception\AuthenticationException的用法示例。


在下文中一共展示了AuthenticationException::getMessageData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onAuthenticationFailure

 public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
 {
     if ($request->isXmlHttpRequest()) {
         if ($this->env != 'dev') {
             $msg = $this->translator->trans($exception->getMessageKey(), $exception->getMessageData(), 'security');
         } else {
             $msg = $exception->getMessage();
         }
         return new JsonResponse($msg, Response::HTTP_UNAUTHORIZED);
     }
     return parent::onAuthenticationFailure($request, $exception);
 }
开发者ID:robstoll,项目名称:PuMa,代码行数:12,代码来源:AuthFailureHandler.php

示例2: onAuthenticationFailure

 public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
 {
     $data = array('message' => strtr($exception->getMessageKey(), $exception->getMessageData()));
     return new JsonResponse($data, 403);
 }
开发者ID:sujit13666,项目名称:SymfonyCRUD,代码行数:5,代码来源:TokenAuthenticator.php

示例3: onAuthenticationFailure

 public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
 {
     throw new \Exception();
     return new Response(strtr($exception->getMessageKey(), $exception->getMessageData()), 403);
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:5,代码来源:KwfUserAuthenticator.php

示例4: getMessageData

 public function getMessageData()
 {
     return $this->messageData !== null ? $this->messageData : parent::getMessageData();
 }
开发者ID:Irvyne,项目名称:KnpUGuard,代码行数:4,代码来源:CustomAuthenticationException.php

示例5: getMessage

 /**
  * Gets the message from the specific AuthenticationException and then
  * translates it. The translation process allows us to customize the
  * messages we want - see the translations/en.yml file.
  */
 private function getMessage(AuthenticationException $authException = null)
 {
     $key = $authException ? $authException->getMessageKey() : 'authentication_required';
     $parameters = $authException ? $authException->getMessageData() : array();
     return $this->translator->trans($key, $parameters);
 }
开发者ID:emiliand,项目名称:rest,代码行数:11,代码来源:ApiEntryPoint.php

示例6: onAuthenticationFailure

 /**
  * This is called when an interactive authentication attempt fails. This is
  * called by authentication listeners inheriting from
  * AbstractAuthenticationListener.
  *
  * @param Request $request
  * @param AuthenticationException $exception
  *
  * @return Response The response to return, never null
  */
 public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
 {
     $data = array('code' => self::RESPONSE_FAILURE_CODE, 'message' => strtr($exception->getMessageKey(), $exception->getMessageData()));
     return new JsonResponse($data, self::RESPONSE_FAILURE_CODE);
 }
开发者ID:coresite,项目名称:apiauthbundle,代码行数:15,代码来源:ApiKeyAuthenticator.php

示例7: onAuthenticationFailure

 /**
  * Called when authentication executed, but failed (e.g. wrong username password).
  *
  * This should return the Response sent back to the user, like a
  * RedirectResponse to the login page or a 403 response.
  *
  * If you return null, the request will continue, but the user will
  * not be authenticated. This is probably not what you want to do.
  *
  * @param Request $request
  * @param AuthenticationException $exception
  *
  * @return Response|null
  */
 public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
 {
     return new JsonResponse(['message' => $this->translator->trans($exception->getMessageKey(), $exception->getMessageData())], 403);
 }
开发者ID:robertdumitrescu,项目名称:Interview-MusicCoursesApplication,代码行数:18,代码来源:TokenAuthenticatorService.php


注:本文中的Symfony\Component\Security\Core\Exception\AuthenticationException::getMessageData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。