Facebook
From PiotrJanczura, 9 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 625
  1. config.yml
  2. bez zmian
  3.  
  4. ---------------------------------------------------
  5. services.yml
  6.  
  7. parameters:
  8. #    parameter_name: value
  9.  
  10. services:
  11.   login_success_handler:
  12.     class: pizzeriaBundle\Listener\LoginSuccessHandler
  13. #    tags:
  14. #      - {name: kernel.event_listener, event: security.interactive_login, method: onAuthenticationSuccess }
  15. #      - {name: kernel.event_listener, event: security.authentication.success, method: onAuthenticationSuccess }
  16.  
  17. --------------------------------------------------
  18. security.yml
  19. security:
  20.   encoders:
  21.     pizzeriaBundle\Entity\UserAbonent:
  22.       algorithm: sha1
  23.       encode_as_base64: false
  24.       iterations: 1
  25.  
  26.   providers:
  27.     pizzeria:
  28.       entity:
  29.         class: pizzeriaBundle\Entity\UserAbonent
  30.         property: username
  31.  
  32.   firewalls:
  33.     dev:
  34.       pattern:  ^/(_(profiler|wdt)|css|images|js)/
  35.       security: false
  36.  
  37.     pizzeria_login:
  38.       pattern:  ^/pizzeria/login$
  39.       security: false
  40.  
  41.     pizzeria_secured:
  42.       pattern: ^/pizzeria
  43.       form_login:
  44.         provider: pizzeria
  45.         check_path: _pizzeria_login_check
  46.         login_path: _pizzeria_login_form
  47.         success_handler: login_success_handler
  48.       logout:
  49.         path: _pizzeria_logout
  50.         target: /pizzeria
  51.  
  52. -----------------------------------------------------
  53. LoginSuccessHandler.php
  54.  
  55. <?php
  56. namespace pizzeriaBundle\Listener;
  57.  
  58. use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
  59. use Symfony\Component\HttpFoundation\Request;
  60. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  61.  
  62. class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface {
  63.  
  64.         public function onAuthenticationSuccess(Request $request, TokenInterface $token) {
  65.                 dump($request);
  66.                 return new \Symfony\Component\HttpFoundation\Response('');
  67.         }
  68. }

Replies to Untitled rss

Title Name Language When
[SF2] Przechwycenie zdarzenia z logowania PiotrJanczura text 9 Years ago.