Symfony 5 Authentication Tutorial Part 1

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • ℹ This is the first recording in the security and authentication series. At the end of this series you will be able to register and authenticate users confidently as well as being able to use 'remember me' functionality, throttle login attempts, give a user roles and much more
    🆓 Join garyclarke.tech for course DISCOUNTS and a FREE Docker + PHP course (worth $49)
    www.garyclarke...
    💻Source code here:
    github.com/Gar...
    🔗 Security documentation:
    symfony.com/do...
    👇Follow me on Social Media:
    Twitter: / garyclarketech
    Linkedin: / garyclarketech
    ⚠️ Notice - this series was recorded using symfony 5.2. There have been some minor changes and some classes have since been removed. You will still be able to follow this tutorial but you will need to combine the documentation in some parts.

КОМЕНТАРІ • 39

  • @balazs.spanyik
    @balazs.spanyik 3 роки тому +5

    Quick note for 6:55 _"Guarantee every user at least has ROLE_USER"_ doesn't mean that YOU have to guarantee it. That line itself, in the User class, guarantees it. So you don't have to store ROLE_USER in the database. You certainly can store it, but then Symfony's gonna duplicate it in memory, which only makes array_unique's job harder. :)

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +2

      Yes..I don't do it for the users which are created later in the course. It was just do demostrate how a role would look in the database. Something other than ROLE_USER would probably have been a better example.
      That said..I appreciate your help Balázs 🤝

  • @adamyoussef6880
    @adamyoussef6880 3 роки тому +1

    It's a gem!

  • @tomatomov9061
    @tomatomov9061 2 роки тому +1

    So we basically didn't understand how to add lines under firewall. Just some autogenerated things

  • @soufwra2396
    @soufwra2396 2 роки тому

    Watching your video helped me fix an auth bug on my deployed project ! Cheers

  • @toufik4044
    @toufik4044 3 роки тому +3

    Hallo,
    thanks for your tutorial...
    How to prevent going back to the secured page after logout in symfony ?

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +1

      You can add invalidate_session: true under the logout key in security.yaml

  • @johnfawcett3503
    @johnfawcett3503 3 роки тому

    Nice tutorial, thanks Gary. Looking forward to the next part

  • @thornwebdesign
    @thornwebdesign 3 роки тому +1

    Nice video. Videos about 'Saml' would be helpful

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      Cheers David..good suggestion. I'll keep it in mind.

  • @dirkkuijer8440
    @dirkkuijer8440 3 роки тому

    Thnx to you it worked finally!

  • @pawecyrklaf4729
    @pawecyrklaf4729 3 роки тому

    Amazing video :D

  • @alenjose1122
    @alenjose1122 3 роки тому

    Thank you for the tutorials.....Can you please make a video on how to setup a login page manually and how to add session start and destroy features to it and all???....It would be helpful as I am a beginner.

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +1

      Hi Alen...that's a good suggestion. I will include this in my learn OO PHP series some time in the future. Thank you.

  • @Popchansons
    @Popchansons 3 роки тому +1

    Hi Gary, thank you very much for this tutorial. Do these videos deal with the "new" Authentication System that CAN be used now and WILL be used in Symfony 6? #enable_authenticator_manager

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      Hi Sebastian...that's a good question. I've been thinking about that and how to approach it. I wasn't sure whether to wait til 6 or not to cover it. There are even slight changes to the current system in 5.3 so it's a challenge to know what to record and when! I'll give it more thought.

    • @Popchansons
      @Popchansons 3 роки тому

      @@GaryClarkeTech The tutorial ist good as it is. Maybe a single Video in a few months could help to show just the differences. I don't know, I'm just a beginner. Thanks again.

    • @shamshid
      @shamshid 2 роки тому

      @@GaryClarkeTech I believe since 5.3 newly created Symfony projects are generated using Symfony's Passport system.

  • @_vela7827
    @_vela7827 3 роки тому

    Thank you for sharing your knowledge, how would I customize the redirection after logout and if there are two ways to login, thank you

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      You're welcome. To change redirection after logout, you need to change the target key under the logout key in security.yaml
      logout:
      path: app_logout
      # where to redirect after logout
      target: app_login

  • @vjianu
    @vjianu 3 роки тому

    hi mate love your vids just starting with Symfony so a very good source of education, one thing I want to ask if you could do a video on how to implement a user auth with steamid that would be great , thanks for the awesome content

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      Thanks Vas..glad you find it helpful. Decent suggestion...think I'd need to do some learning myself first but I'll defo think about it!

  • @mosesegboh
    @mosesegboh 2 роки тому

    how can I get the Id of the currently logged in user?

    • @GaryClarkeTech
      @GaryClarkeTech  2 роки тому

      Like this:
      symfony.com/doc/current/security.html#fetching-the-user-object

  • @zenobikraweznick
    @zenobikraweznick 2 роки тому

    6:00 just stop it will you. Migrate colon ? I don't allow my colon to be migrated anywhere!!!

  • @younex111
    @younex111 3 роки тому

    Great Job Gary Go Ahead just i have a proposition it would be very nice if you implement manager interface roles (Admin,Editor,User) and everyone of them has his privileges while the admin could assign and change roles hope its good idea to share have a nice day :)

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +1

      Thanks Younes and good suggestion. I'll see what I can come up with 👍

    • @younex111
      @younex111 3 роки тому

      @@GaryClarkeTech your welcome brother i really appreciate what you are doing and i respect you good bless you
      so im working now on the same thing there always lot of choices but i would like make it as a services or subscribers would much better and automatically to be reused in every project have a nice day brother

    • @younex111
      @younex111 3 роки тому

      just i mess something if you have LinkedIn its my pleasure to share your tuto form my community

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +1

      @@younex111 Sure Younes..that would be cool
      My LinkedIn is
      www.linkedin.com/in/gary-clarke-6a705312a/
      I'm unable to upload this video there though becasue it's > 10 mins. Not sure if there's a way to link to YT

    • @younex111
      @younex111 3 роки тому

      Great gary so you don't need to upload it just create a poste and share the link of the video on youtube that Will be awesome I can do it but I want people discover your Channel that would be better