Code Monkey home page Code Monkey logo

Comments (8)

andrzejkrzywda avatar andrzejkrzywda commented on June 24, 2024

I've had a long deliberation blocker here - whether to go with Devise or start from scratch. I now think going from scratch to have an event sourced Authentication module is the way to go. However with this ticket I imagine to go with something super simplest. Maybe just have commands for setting the accounts (login/password) for clients (without the registration UI yet), use them in the seeds. Then some UI (login/password) only for the customer panel.

from ecommerce.

pstrzalk avatar pstrzalk commented on June 24, 2024

Hi, @andrzejkrzywda

As I have mentioned, I would love to help out with this one.

I've seen the work around Client idea in 0af1cae and f962d0b

Do you see Client entity/commands/events as a part of Ordering context or should it rather get its own one?
Or perhaps the Client referred in this issue should in fact be a Customer and that's Customer who should be given a login/password?

I would love to align this before I ship my idea of the solution

from ecommerce.

andrzejkrzywda avatar andrzejkrzywda commented on June 24, 2024

I think we can start with a new BC called Authentication (similarly as in the red book - the Identity and Access BC).

The Account seems like a good building block here.
For the start we probably need:

  • RegisterAccount(id)
  • SetLogin(account_id, login)
  • SetPasswordHash(account_id, password_hash)
  • ConnectAccountToClient(account_id, client_id)

The consequence would be that we allow multiple accounts per client, which is fine by me.

Those commands would then be used in the seeds to set up the existing clients. We will create UI for creating accounts as a separate ticket.

For the login process we probably need something like LoginSession.

  • StartSession(uid, credentials)

Let's make the Logout feature as a separate ticket.

BTW, currently we use client/customer as synonyms.

How does it sound?

from ecommerce.

pstrzalk avatar pstrzalk commented on June 24, 2024

Sounds great!
Thank you very much for the detailed description. I will jump into it next week and hopefully deliver shortly after.

from ecommerce.

andrzejkrzywda avatar andrzejkrzywda commented on June 24, 2024

There was a bit of progress about it recently. Instead of using URL, we now store cookies.

some context: https://dev.to/andrzejkrzywda/implementing-authentication-in-tiny-steps-jhn

@pstrzalk how is it going? need any help?

from ecommerce.

pstrzalk avatar pstrzalk commented on June 24, 2024

Thank you very much for the head's up @andrzejkrzywda

Actually, I need 48h days too keep up with all the plans and promisses... I'm terribly sorry to keep you waiting for so long.

Back when I started, I've added the new BC and the first events. But I had to put it on a shelf for much longer than I expected.
I will be back with my mac in 5-6 days. I will make sure that what I had prepared makes sense and push forward

from ecommerce.

pstrzalk avatar pstrzalk commented on June 24, 2024

I have re-visited my changes and adjusted a bit. I've created a WIP PR at #175

So far I've

  • added Authentication BC
  • added commands & events
    • RegisterAccount
    • SetLogin
    • SetPasswordHash
    • ConnectAccountToClient
  • added tests and made sure mutation tests work fine

When you have a chance, please take a look and let me know what you think. Again - sorry for the delay.

The next step, if I understand correctly, is to:

  • add LoginSession AggregateRoot with start_session method
  • add StartSession command & SessionStarted event
  • raise error if credentials don't match
  • use this all in the login action of the Client::ClientsController

The thing I'm not sure about is - what's the intended approach for checking the credentials?
@andrzejkrzywda

from ecommerce.

tomaszpatrzek avatar tomaszpatrzek commented on June 24, 2024

Added the possibility to login with password.

Extracted tasks:

from ecommerce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.