用户变动撤销所有刷新token,立即失效accesstoken
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
import { isAccessTokenInvalidated } from '@/lib/access-token-invalidation';
|
||||
import { getAuthInfoFromCookie } from '@/lib/auth';
|
||||
import { TOKEN_CONFIG } from '@/lib/refresh-token';
|
||||
import { isTVModeEnabled } from '@/lib/tv-mode';
|
||||
@@ -89,6 +90,11 @@ export async function middleware(request: NextRequest) {
|
||||
return handleAuthFailure(request, pathname);
|
||||
}
|
||||
|
||||
if (isAccessTokenInvalidated(authInfo)) {
|
||||
console.log(`Access token invalidated for ${authInfo.username}`);
|
||||
return handleAuthFailure(request, pathname);
|
||||
}
|
||||
|
||||
// 签名验证通过
|
||||
// 注意:Token 续期由前端负责,Middleware 不再自动刷新
|
||||
return NextResponse.next();
|
||||
|
||||
Reference in New Issue
Block a user