Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Symfony Guard - You don't need FOSUserBundle

B01ca5829a2531c15bbc1398f78a1205?s=47 Marko Kunic
September 28, 2017

Symfony Guard - You don't need FOSUserBundle

Talk about Symfony Guard and how we do not need FOSUserBundle, the talk was presented at my company. The code can be found here: https://github.com/kunicmarko20/guard-talk-example, if you need any kind of help feel free to ping me on twitter @kunicmarko20. Talk is inspired by great tutorials at https://knpuniversity.com that @weaverryan is creating, be sure to check them out.

B01ca5829a2531c15bbc1398f78a1205?s=128

Marko Kunic

September 28, 2017
Tweet

More Decks by Marko Kunic

Other Decks in Programming

Transcript

  1. @kunicmarko20 Symfony Guard You don’t need FOSUserBundle

  2. @kunicmarko20 FOSUserBundle Pros • Login Page • Reset Password •

    Last Login Cons • Login Page • Reset Password • Username field • Overwrite everything
  3. @kunicmarko20 SonataUserBundle Pros • User Admin Class • Admin Login

    Page • Role FormType Cons • Wrapper around FOSUserBundle • Adds 22 fields to your User Entity • User Profile Menu and Dashboard page
  4. @kunicmarko20

  5. @kunicmarko20

  6. @kunicmarko20 In the rest of the talk, my focus will

    be on replacing SonataUserBundle and implementing Symfony Guard because we are using SonataAdminBundle and a lot of people just go with SonataUserBundle as it is easier. While removing SonataUserBundle we will basically be removing FOSUserBundle as well.
  7. @kunicmarko20

  8. @kunicmarko20 The “new” Symfony Authentication component • Since Symfony 2.8

    (2015) • Easy to implement • Customize success/failure behavior • Customize error messages • Customize how you load user
  9. @kunicmarko20 What do we need? • User Entity • Custom

    User Provider (optional) • Login Form Type • Controller • Guard Authenticator
  10. @kunicmarko20 User Entity

  11. @kunicmarko20

  12. @kunicmarko20

  13. @kunicmarko20

  14. @kunicmarko20 User Provider

  15. @kunicmarko20

  16. @kunicmarko20

  17. @kunicmarko20

  18. @kunicmarko20 Login Form Type

  19. @kunicmarko20

  20. @kunicmarko20 Controller

  21. @kunicmarko20

  22. @kunicmarko20 Authenticator

  23. @kunicmarko20

  24. @kunicmarko20

  25. @kunicmarko20

  26. @kunicmarko20

  27. @kunicmarko20

  28. @kunicmarko20

  29. @kunicmarko20

  30. @kunicmarko20 HashPasswordListener

  31. @kunicmarko20

  32. @kunicmarko20

  33. @kunicmarko20 Last Login

  34. @kunicmarko20

  35. @kunicmarko20 The end https://github.com/kunicmarko20/guard-talk-example