diconium / ethereal-pulse

Apache License 2.0
1 stars 3 forks source link

Develop authentication and authorisation mechanisms for WebAPP #20

Closed almeiphi closed 4 months ago

almeiphi commented 5 months ago

Implement authentication and authorisation mechanisms using Remix full-stack capabilities. This will allow users to securely log in and access protected resources through a dedicated middleware which will be provided by Remix-auth package.

Requirements

  1. User Registration

    • Create route with correct validations.
    • Hash passwords before storing them in the database.
    • Store User id in a secure cookie.
  2. User Login

    • Create route with correct validations.
    • Validate user credentials.
    • Generate cookie with User id
  3. Protected Routes

    • Protect routes with Remix-auth built in methods.
    • Ensure only authenticated users can access these routes.
  4. Logout

    • Invalidate the session cookie on the client side.

Steps to Implement

  1. User Registration Endpoint

    • [x] Create a registration endpoint (/signup).
    • [x] Hash the user’s password using bcrypt.
    • [x] Store the user information in simulated database.
    • [x] Generate a session cookie with User id.
  2. User Login Endpoint

    • [x] Create a login endpoint (/login).
    • [x] Validate the user credentials.
    • [x] Generate a session cookie with User id.
  3. Protecting Routes

    • [x] Apply Remix-auth middleware to routes that require authentication.
    • [x] Ensure unauthorised requests receive an appropriate response.
  4. Logout Functionality

    • [x] Implement client-side logout functionality in the web application.
    • [x] Ensure the cookie is removed upon logout.
  5. Documentation and Testing

    • [ ] Document relevant methods.
    • [ ] Write tests for the registration, login, and JWT verification processes.

Resources

Acceptance Criteria

Additional Information


teixeped commented 4 months ago

Edited ticket to reflect Astro to Remix change

teixeped commented 4 months ago

Updated ticket to include Remix-auth for session authentication and remove JWT. Remix-auth supports OAuth/Auth0 strategy if we want to update in the future