workos / authkit-nextjs

The WorkOS library for Next.js provides convenient helpers for authentication and session management using WorkOS & AuthKit with Next.js.
MIT License
43 stars 9 forks source link

Add auth middleware mode #29

Closed PaulAsjes closed 2 months ago

PaulAsjes commented 2 months ago

Fixes https://github.com/workos/authkit-nextjs/issues/20

Adds a middleware auth mode to the library.

By default auth is invoked by a getUser call on a page, however there are some use cases where you wouldn't want this, like if your page doesn't need user data but you still want it protected.

This adds "middleware auth mode", where auth is invoked by the middleware directly instead of on a page-by-page basis. When enabled, middleware auth mode will require sign in for all pages specified in the middleware config matches, unless the page is included in the allowlist for unauthenticated paths.

socket-security[bot] commented 2 months ago

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/node@20.12.7 None +1 2.1 MB types
npm/jose@5.2.4 None 0 504 kB panva
npm/next@14.2.2 environment, filesystem, network, shell, unsafe +15 205 MB vercel-release-bot
npm/path-to-regexp@6.2.2 None 0 108 kB blakeembrey
npm/typescript-eslint@7.7.1 Transitive: environment, filesystem +48 8.36 MB jameshenry

🚮 Removed packages: npm/@types/node@20.11.28, npm/jose@5.2.3, npm/next@14.1.3, npm/typescript-eslint@7.2.0

View full report↗︎