-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from CapgeminiInventUK/feat/enable-auth-flag
fix(#71): correct full docker compose to use .env.docker
- Loading branch information
Showing
6 changed files
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { authOptions } from '@/lib/utils/auth-options'; | ||
import NextAuth from 'next-auth'; | ||
|
||
const handler = NextAuth(authOptions); | ||
const handler = NextAuth( authOptions); | ||
export { handler as GET, handler as POST }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
export { default } from 'next-auth/middleware'; | ||
import { NextRequestWithAuth, withAuth } from 'next-auth/middleware'; | ||
import { NextResponse } from 'next/server'; | ||
|
||
export default function middleware(req: NextRequestWithAuth) { | ||
const isAuthEnabled = process.env.NEXTAUTH_ENABLE === 'true' ; | ||
|
||
if (isAuthEnabled) { | ||
return (withAuth(req)); | ||
} else { | ||
console.warn('Auth is disabled'); | ||
return NextResponse.next(); | ||
} | ||
} | ||
|
||
|
||
|
||
export const config = { | ||
matcher: ['/:path*'], | ||
matcher: [ '/:path*' ], | ||
}; |