mirror of
https://github.com/j93es/oauth-backend.git
synced 2026-06-04 06:41:52 +09:00
Merge branch 'main' of https://github.com/j93es/oauth-backend into feature/backend-refactoring
This commit is contained in:
commit
723e14c314
3 changed files with 77 additions and 1 deletions
|
|
@ -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()]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue