Merge branch 'main' of https://github.com/j93es/oauth-backend into feature/backend-refactoring

This commit is contained in:
imnyang 2025-06-08 01:30:44 +09:00
commit 723e14c314
3 changed files with 77 additions and 1 deletions

View file

@ -1,6 +1,7 @@
from mitmproxy import http
import asyncio
from pkce_check import PKCEDowngradeChecker
from ScopeDetection import ScopeDetection
class PKCEAddon:
@ -16,5 +17,23 @@ class PKCEAddon:
except Exception as e:
print(f"[ERROR] Addon failed: {e}")
class ScopeAddon:
def __init__(self):
self.checker = ScopeDetection()
self._flow_map = {} # 요청 정보를 저장
addons = [PKCEAddon()]
async def request(self, flow: http.HTTPFlow):
self._flow_map[flow.id] = {
"method": flow.request.method,
"url": flow.request.pretty_url,
"query": flow.request.query,
}
async def response(self, flow: http.HTTPFlow):
try:
await self.checker.test(flow)
except Exception as e:
print(f"[ERROR] ScopeDetection failed: {e}")
addons = [PKCEAddon(), ScopeAddon()]