dify/api/controllers/console/auth
GareArc 772f450b29
feat(api): lift device-flow approve/deny to /openapi/v1 (Phase D.13-14)
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).
2026-04-26 23:57:28 -07:00
..
activate.py refactor: replace bare dict with dict[str, Any] in response converter… (#35212) 2026-04-14 19:45:04 +00:00
data_source_bearer_auth.py refactor: port reqparse to Pydantic model (#28949) 2025-12-05 13:05:53 +09:00
data_source_oauth.py refactor: port api/controllers/console/app/audio.py api/controllers/console/app/message.py api/controllers/console/auth/data_source_oauth.py api/controllers/console/auth/forgot_password.py api/controllers/console/workspace/endpoint.py (#30680) 2026-02-02 18:03:07 +09:00
email_register.py fix: fix orm_exc.DetachedInstanceError (#34904) 2026-04-10 07:13:59 +00:00
error.py Feat/email register refactor (#25369) 2025-09-12 10:24:54 +08:00
forgot_password.py fix: fix orm_exc.DetachedInstanceError (#34904) 2026-04-10 07:13:59 +00:00
login.py refactor(auth): standardize failed login audit logging (#35054) 2026-04-13 12:26:13 +00:00
oauth_device.py feat(api): lift device-flow approve/deny to /openapi/v1 (Phase D.13-14) 2026-04-26 23:57:28 -07:00
oauth_server.py chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
oauth.py fix: fix orm_exc.DetachedInstanceError (#34904) 2026-04-10 07:13:59 +00:00