Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: redwoodjs/auth-dbauth-middleware - Part 2/3 - Auth Middleware for dbAuth to authenticate users via cookie #10447

Merged
merged 23 commits into from
Apr 19, 2024

Conversation

dthyresson
Copy link
Contributor

@dthyresson dthyresson commented Apr 11, 2024

Item: https://github.com/orgs/redwoodjs/projects/18/views/1?pane=issue&itemId=59186936

WIP

  • Implements createDbAuthMiddleware in @redwoodjs/auth-dbauth-middleware:build

TODO

  • Update build to not use babel, instead use the new patterns (e.g. @redwoodjs/og-gen)
  • Add additional tests for middleware
  • Validate multivalue header logic (dbauthhandler will return an Array of values for multiValueHeaders, and NOT the actual key "multiValueHeaders")

…are that authenticates users using a database table. This middleware is intended to be used with redwoodjs/auth.
@dthyresson dthyresson self-assigned this Apr 11, 2024
@dthyresson dthyresson requested a review from dac09 April 11, 2024 19:47
@dthyresson dthyresson added the release:feature This PR introduces a new feature label Apr 11, 2024
@dthyresson dthyresson added this to the RSC milestone Apr 11, 2024
@@ -0,0 +1,4 @@
declare module '@redwoodjs/vite/middleware' {
export type { MiddlewareRequest } from 'r@redwoodjs/vite/middleware'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typos here.... but I need to check this with Dom, or someone working on the esm conversion.

@dac09 dac09 changed the title feat: redwoodjs/auth-dbauth-middleware - Auth Middleware for dbAuth to authenticate users via cookie feat: redwoodjs/auth-dbauth-middleware - Part 2/3 - Auth Middleware for dbAuth to authenticate users via cookie Apr 15, 2024
dthyresson and others added 8 commits April 15, 2024 14:48
…-dbauth-middleware

* 'main' of github.com:redwoodjs/redwood:
  chore(location): Accept URL-like object (#10467)
  fix(router): Remove barrel exports from router.tsx (#10464)
  chore(dbauth-mw): Refactor web side dbAuth creation (#10460)
  chore(router): Prevent circular dependency for namedRoutes (#10463)
  chore(router): route-validators: Better types and clean up comments (#10462)
  feat(server-auth): dbAuth 3/3 -  handle login, logout, signup, etc. requests if forwarded from middleware (#10457)
  docs(router): Document new NavLink className replacement behavior (#10401)
  chore(refactor): Split the router out into smaller logical units (#10434)
  feat(server-auth): Part 1/3: dbAuth middleware support (web side changes) (#10444)
  chore(auth): Build: Put ESM at the root, and CJS in /cjs (#10458)
  fix(ssr): Successfully serve static assets like `favicon.png` (#10455)
  chore(deps): update chore (#10367)
  (docs) Fix useCache headers and links (#10451)
  chore: remove aws-lambda (#10450)
  chore(deps): update dependency typescript to v5.4.5 (#10452)
  feat(og-gen): Update implementation of useLocation | Update App template (#10441)
  feat(og-gen): Adds package and vite plugin for dynamic og generation (#10439)
Copy link
Collaborator

@dac09 dac09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have validated that this is working on a SSR enabled project.

We still want more tests, and for CI to go green

@dthyresson dthyresson marked this pull request as ready for review April 18, 2024 14:49
@dthyresson
Copy link
Contributor Author

@dac09 Tests added (always room for improvements) but held off on most webAuthn tests as not sure id the middleware has to allow some "methods" to be allowed w/out cookie verification (like webAuthnRegOptions which is a GET).

@dac09 dac09 modified the milestones: RSC, SSR Apr 19, 2024
@dac09
Copy link
Collaborator

dac09 commented Apr 19, 2024

Awesome DT, just made a slight change to the test. Merging in! We can go through webAuthN together.

@dac09 dac09 enabled auto-merge (squash) April 19, 2024 04:41
@dac09 dac09 merged commit 26ef03d into main Apr 19, 2024
46 checks passed
@dac09 dac09 deleted the dt-implement-dbauth-middleware branch April 19, 2024 04:55
dac09 added a commit that referenced this pull request Apr 22, 2024
…g-gen-mw-p2

* 'main' of github.com:redwoodjs/redwood:
  fix(deps): update React to latest canary 19.x (#10496)
  fix(upgrade): Download yarn patches (#10497)
  Revert React 19 upgrade (#10482 and #10491) (#10495)
  Modified type for describeScenario (#10468)
  fix(upgrade): Download yarn patches (#10491)
  fix(deps): update React to latest canary 19.x (#10482)
  chore(dataMigrate): Fix package.json directory value (#10490)
  RSC: css preinit: Add required option precedence (#10481)
  chore(renovate): Remove config for unused package (#10489)
  RSC: Update test projects to use new @apollo/client-react-streaming (#10488)
  RSC: Remove unused vite patch from test-project-rsa (#10487)
  chore(ssr): Switch to use `@apollo/client-react-streaming` package (#10484)
  chore(docs): Move .mdx import into separate file (#10486)
  fix(cli): avoid `npx` during upgrade command (#10479)
  fix: Fixes Unknown Fragment issues due to GraphQL Tag type mismatch in web (#10357)
  RSC: Clean up some comments and logs (#10480)
  feat: redwoodjs/auth-dbauth-middleware - Part 2/3 - Auth Middleware for dbAuth to authenticate users via cookie (#10447)
@Josh-Walker-GM Josh-Walker-GM modified the milestones: SSR, v8.0.0 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants