Getting Authenticated User in Spring Boot

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024
  • НаукаНаука

Комментарии • 8

  • @apex095
    @apex095 3 года назад +2

    Hi Basar. How can one can implement the password reset functionality using Spring boot ? I have recently enrolled in your Test driven development tutorial on Udemy and was curious to know if this feature can be added to the Hoaxify project.

    • @ProgrammingwithBasar
      @ProgrammingwithBasar  3 года назад +2

      Generally password reset functionality is having a flow like this.
      - In client, you enter your email address in a password reset request form. This email info is sent to backend.
      - Backend generates a unique token associated with this operation. Then it sends an email having a link in it for opening password reset page. The token generated at backend will be added to this link.
      - User opens that incoming email and clicks the link. It opens password reset page on client and with this way client retrieves the password reset token.
      - User fills the password reset form with new password. Then sends the request. This request contains both the new password and the token for this password reset operation.
      - Backend queries the users based on this password reset token and finds out which user is updating it's password. Then updates the password field of that user in database.
      PS: In my other course, Test Driven Development with Node Js, I'm demonstrating this flow in that course project. You can access to that project resository here. github.com/basarbk/tdd-nodejs

    • @apex095
      @apex095 3 года назад

      @@ProgrammingwithBasar Wow. Thanks for the reply Basar. I will check the link. You are very helpful.
      I hope your channel grows and becomes the top tech channel on RUclips 👍🏽

  • @nianeddavid7985
    @nianeddavid7985 3 года назад +1

    Good video 👍

  • @marjankarafiloski5757
    @marjankarafiloski5757 3 года назад

    In this and in the test driven web development with Spring boot and react Im getting the same 401 Unauthorized error on the configuration ... I recommend to everyone to watch that tutorial i haven't seen better tutorial yet ... But still something is not working on my end...

  • @ecernys
    @ecernys 3 года назад

    Is it possible to return a projection of loged in user? So that we don't expose the password. Or we have to create a method in appUser witch returns only needed fields?

    • @ProgrammingwithBasar
      @ProgrammingwithBasar  3 года назад +1

      If you would like to return projection, then you must be querying the user through user repository again. Because there is actually a concrete proxy implementation of the projection interface, which is created by spring data during runtime. In the controller, we already have the user object. So running the query second time just for retrieving a projection result is not the best solution. Instead we can return a data transfer object. In that object we would contain only the fields we want in the response.

    • @ecernys
      @ecernys 3 года назад

      @@ProgrammingwithBasar Thank you for your thorough answer