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

chore(server-auth): Automagic middleware auth on supported providers (dbAuth so far) #10529

Merged

Conversation

dac09
Copy link
Collaborator

@dac09 dac09 commented Apr 30, 2024

Closes https://github.com/orgs/redwoodjs/projects/18/views/3?pane=issue&itemId=61343580

This change means that we will automatically configure the dbAuth client in middleware mode, based on the redwood.toml flag.

Originally I was hesitating to do this, because we were expecting to have to customise the supabase/firebase ones, but looks like we have a way around it!

Also renames useMiddlewareAuth -> middlewareAuthEnabled

What this means?

You create your dbAuth client exactly the same as before (no template changes necessary!)

const dbAuthClient = createDbAuthClient({
  webAuthn: new WebAuthnClient(),
})

export const { AuthProvider, useAuth } = createAuth(dbAuthClient)

@dac09 dac09 added this to the SSR milestone Apr 30, 2024
@dac09 dac09 added the release:chore This PR is a chore (means nothing for users) label Apr 30, 2024
@dac09 dac09 requested a review from dthyresson April 30, 2024 09:32
Copy link
Contributor

@dthyresson dthyresson left a comment

Choose a reason for hiding this comment

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

LGTM. Approved. Nice pattern to follow for other providers.

@dthyresson dthyresson merged commit 2d134a8 into redwoodjs:main Apr 30, 2024
46 checks passed
@dac09 dac09 deleted the chore/rename-middleware-property-authClients branch April 30, 2024 14:44
dac09 added a commit to dac09/redwood that referenced this pull request May 1, 2024
…e-middleware-client

* 'main' of github.com:redwoodjs/redwood:
  chore(server-auth): Automagic middleware auth on supported providers (dbAuth so far) (redwoodjs#10529)
  feat(baremetal): Add more details to error messages (redwoodjs#10527)
  feat(baremetal): Add verbose output to ssh exec (redwoodjs#10525)
  Fix typos in seo-head (`<Metadata />`) docs (redwoodjs#10526)
  chore(cli): Wrap NodeSSH to make sshExec an instance method (redwoodjs#10524)
  Fix broken Azure / MSAL documentation links (redwoodjs#10505)
  chore(deps): Stop using PR build of rehackt - use proper version (redwoodjs#10523)
  feat(og-gen): Implement middleware and hooks (redwoodjs#10469)
  RSC: Rename RSC CI test case (redwoodjs#10521)
  feat(eslint): Disable restricted $api imports for entryserver (redwoodjs#10520)
  RSC: Add RSC+SSR smoke test to CI (redwoodjs#10477)
  fix(dbauth-mw): Use response passed in to middleware (redwoodjs#10516)
@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:chore This PR is a chore (means nothing for users)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants