|
1 | 1 | import { createLogger } from '@sim/logger' |
2 | 2 | import { type NextRequest, NextResponse } from 'next/server' |
3 | 3 | import { z } from 'zod' |
4 | | -import { checkInternalAuth } from '@/lib/auth/hybrid' |
| 4 | +import { checkSessionOrInternalAuth } from '@/lib/auth/hybrid' |
5 | 5 | import { validateAlphanumericId, validateJiraCloudId } from '@/lib/core/security/input-validation' |
6 | 6 | import { getConfluenceCloudId } from '@/tools/confluence/utils' |
7 | 7 |
|
@@ -76,7 +76,7 @@ const deletePageSchema = z |
76 | 76 |
|
77 | 77 | export async function POST(request: NextRequest) { |
78 | 78 | try { |
79 | | - const auth = await checkInternalAuth(request) |
| 79 | + const auth = await checkSessionOrInternalAuth(request) |
80 | 80 | if (!auth.success || !auth.userId) { |
81 | 81 | return NextResponse.json({ error: auth.error || 'Unauthorized' }, { status: 401 }) |
82 | 82 | } |
@@ -152,7 +152,7 @@ export async function POST(request: NextRequest) { |
152 | 152 |
|
153 | 153 | export async function PUT(request: NextRequest) { |
154 | 154 | try { |
155 | | - const auth = await checkInternalAuth(request) |
| 155 | + const auth = await checkSessionOrInternalAuth(request) |
156 | 156 | if (!auth.success || !auth.userId) { |
157 | 157 | return NextResponse.json({ error: auth.error || 'Unauthorized' }, { status: 401 }) |
158 | 158 | } |
@@ -261,7 +261,7 @@ export async function PUT(request: NextRequest) { |
261 | 261 |
|
262 | 262 | export async function DELETE(request: NextRequest) { |
263 | 263 | try { |
264 | | - const auth = await checkInternalAuth(request) |
| 264 | + const auth = await checkSessionOrInternalAuth(request) |
265 | 265 | if (!auth.success || !auth.userId) { |
266 | 266 | return NextResponse.json({ error: auth.error || 'Unauthorized' }, { status: 401 }) |
267 | 267 | } |
|
0 commit comments