mirror of
https://github.com/langgenius/dify.git
synced 2026-05-21 17:20:25 +08:00
DeviceApproveApi + DeviceDenyApi (cookie-authed) move to
controllers/openapi/oauth_device/{approve,deny}.py. Decorator stack
preserved verbatim: setup_required → login_required →
account_initialization_required → bearer_feature_required →
rate_limit. Audit event names ('oauth.device_flow_approved' /
'oauth.device_flow_denied') unchanged so the OTel exporter
registration keeps routing them.
The legacy /console/api/oauth/device/{approve,deny} mounts are
re-registered on console_ns from the bottom of the new files via a
local-import _register_legacy_console_mount() helper. The local
import breaks an import cycle that would otherwise form: openapi
imports console.wraps for setup_required, console.__init__.py imports
console.auth.oauth_device, which would re-import the openapi class
mid-load. Deferring console_ns past the class definition resolves it.
console/auth/oauth_device.py becomes a 9-line placeholder (the
existing console.__init__.py `from .auth import (..., oauth_device,
...)` keeps loading until Phase F prunes the import).
Plan: docs/superpowers/plans/2026-04-26-openapi-migration.md (in difyctl repo).
9 lines
403 B
Python
9 lines
403 B
Python
"""Placeholder. Legacy /console/api/oauth/device/{approve,deny} mounts
|
|
are registered from the canonical openapi handlers in
|
|
controllers/openapi/oauth_device/{approve,deny}.py. This file stays
|
|
on disk only so controllers/console/__init__.py's
|
|
`from .auth import (... oauth_device, ...)` keeps working until
|
|
Phase F retires the legacy paths and prunes that import.
|
|
"""
|
|
from __future__ import annotations
|