kislerdm / diagramastext

Application to streamline diagram generation using plain English instructions instead of code
https://diagramastext.dev
Apache License 2.0
24 stars 1 forks source link

Add authN layer #15

Open kislerdm opened 1 year ago

kislerdm commented 1 year ago

Context

As a user, I want to have access to better model(s) and advanced features.

Problem

Authentication layer is required.

Proposed Solution

Implement pass-wordless authentication using Auth0:

Note that we maintain the option for a user to assume the "guest role", i.e. no authentication.

Flowchart

flowchart LR
    subgraph App
        trigger[Button 'Generate Diagram'] --> cache
        cache --> cacheGuest{Guest prefernece}
        cacheGuest -- No --> cacheAuth{JWT found}
        download[Button 'Download'] --> diagram[Diagram SVG]
    end
    subgraph Auth[Authentication Service]
        authFlow{Is IdP?}
        authFlow -- No --> email
        email[Email flow] --> SMTP
        email --> Logic
        Logic --> db[(Userbase)]
    end

    user((User)) --> trigger
    user --Download generated diagram--> download
    server --> diagram
    cacheGuest -- Yes --> server[Server: Core]
    cacheAuth --Yes--> server
    cacheAuth --No--> Logic
    user -- Authenticates --> authFlow
    user -- Enters email --> email
    user -- Enters access code --> Logic
    SMTP -- Sends access code --> userEmail(((User email server)))
    user -- Fetch access code --> userEmail
    Logic -- Returns JWT --> cache
    authFlow -- Yes --> IdP(((3rd party IdP)))
    user -- Confirms usage --> IdP
    IdP -- Configrms authentication --> Logic

### References

- Auth0 - API GW AuthN - webclient logic with vanilla js: ~~ - auth0 docu~~ ~~ - auth0 user's blog~~

Acceptance Criteria

kislerdm commented 1 year ago

The auth0 account was created.

kislerdm commented 1 year ago

It was identified that unfortunately the auth0 free plan does not include passwordless authentication. On that basis, aws cognito to be used instead.

References