mailsentry-auth 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/middleware.d.mts +28 -0
- package/package.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Middleware matcher patterns - exported separately for static analysis
|
|
5
|
+
* Pattern includes:
|
|
6
|
+
* - / (home route and all other routes for authentication protection)
|
|
7
|
+
* - /login route (for authenticated user redirection)
|
|
8
|
+
* Excludes: API routes, Next.js internals, static assets, and file extensions
|
|
9
|
+
*/
|
|
10
|
+
declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)", "/login"];
|
|
11
|
+
/**
|
|
12
|
+
* Middleware configuration - runs on all routes (including home) and login page
|
|
13
|
+
*/
|
|
14
|
+
declare const config: {
|
|
15
|
+
matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)", "/login"];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Authentication middleware entry point
|
|
20
|
+
* Chain order:
|
|
21
|
+
* 1. MethodFilterHandler - filters HTTP methods (GET/HEAD only)
|
|
22
|
+
* 2. RouteProtectionHandler - identifies protected routes
|
|
23
|
+
* 3. LoginRedirectHandler - redirects authenticated users away from login
|
|
24
|
+
* 4. AuthenticationHandler - validates JWT and handles query parameter cleanup
|
|
25
|
+
*/
|
|
26
|
+
declare function middleware(req: NextRequest): Promise<NextResponse>;
|
|
27
|
+
|
|
28
|
+
export { config, middleware, middlewareMatcher };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailsentry-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Next.js 15 authentication package with multi-step auth flow, cross-tab sync, and Zustand state management",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"require": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"./middleware": {
|
|
15
|
-
"types": "./dist/middleware.d.
|
|
15
|
+
"types": "./dist/middleware.d.mts",
|
|
16
16
|
"import": "./dist/middleware.mjs"
|
|
17
17
|
},
|
|
18
18
|
"./server": {
|