[feature](fe) Share authentication policy between MySQL and Flight SQL (#71078)

### Background

Doris FE supports local accounts and configured authentication
integrations. MySQL applies account bindings, the configured primary
authenticator, and the fallback chain during login. Flight SQL
previously checked plain passwords directly and kept only the mapped
user in its session.

### What problem does this PR solve?

Issue Number: #69944
Related PR: #68923 (adds authentication integration bindings)
PR Type: Feature

Problem Summary:

ADBC clients need the same account and authorization policies as MySQL
clients. The Flight SQL login adapter now delegates to the same FE
authentication manager, passing the credential type it can represent.
The change also carries the authenticated principal and roles into
Flight connection admission so authorization can use the complete
identity. Ordinary unbound username/password and established FE-local
bearer sessions continue to work.

### Details

- **Change map:** 387 additions and 317 deletions in production, 223
additions and 19 deletions in tests, and no generated files or docs.
Shared selection, checks, and outcome application are in
`AuthenticatorManager` and its authenticator implementations. Flight
credential and session adapters replace the old password-only helpers.
The tests cover both entry points, binding and account policy, and
Flight session admission.
- **Scope:** FE login policy, single-step credential adaptation, and
Flight session admission. Handshake-only legacy authenticators stay
available through MySQL. Flight TLS and live IAM Role STS login are
outside this change.
- **Design:** Reuse the selection, external identity mapping, role
mapping, and JIT paths in #69944. Keeping credential exchange in each
adapter preserves MySQL packet semantics while Flight supplies only the
credentials and transport it actually has.
- **Usage:** Connect an ADBC Flight SQL client with its existing
`username` and `password` options. Administrators can use the existing
`CREATE USER ... IDENTIFIED WITH AUTHENTICATION INTEGRATION ... AS`
syntax. An initial Flight Basic exchange can declare a credential type
through `x-doris-auth-credential-type`. The current listener rejects
types that require secure transport.
- **Default behavior:** Basic login declares `CLEAR_TEXT_PASSWORD`. An
explicit binding selects one integration. Unbound users follow the
configured primary authenticator and existing `authentication_chain`.
JIT still requires an integration that enables it. The existing Flight
connection limits and bearer session lookup still apply.
- **Compatibility:** No FE/BE RPC or metadata format changes. The
default method on the legacy authenticator interface preserves existing
implementations. The historical test reused a 4.1.5 BE for a query.
Rolling upgrades were not exercised.
- **Behavior change:** Flight login now enforces bound-account and
account-lock checks and applies authenticated roles and JIT context
before pool admission.
- **Security and privileges:** Bound identities must match the
integration outcome. A bound login never falls back. Account locks and
certificate requirements are checked before opening a session. The
plaintext Flight listener reports its transport accurately, so
secure-transport requirements remain enforced. No new outbound endpoint
or SQL privilege is introduced.
- **Follow-up plan:** Add and verify Flight TLS, then run OIDC and IAM
Role end to end over supported transport. Verify live STS with the final
IAM token contract.

```mermaid
classDiagram
    direction LR
    class Authenticator {
        <<interface>>
    }
    class FlightSessionsManager {
        <<interface>>
    }
    MysqlProto ..> AuthenticatorManager : delegates login
    DorisFlightSqlService --> FlightBearerTokenAuthenticator : installs
    FlightBearerTokenAuthenticator --> FlightCredentialValidator : validates initial credentials
    FlightBearerTokenAuthenticator --> FlightSessionsManager : checks bearer sessions
    FlightCredentialValidator ..> AuthenticateRequest : builds
    FlightCredentialValidator --> AuthenticatorManager : authenticates
    FlightCredentialValidator --> FlightSessionsManager : opens session
    AuthenticatorManager ..> Authenticator : selects and invokes
    AuthenticatorManager ..> Auth : checks bindings and locks
    Authenticator <|.. DefaultAuthenticator
    Authenticator <|.. LdapAuthenticator
    Authenticator <|.. AuthenticationPluginAuthenticator
    Authenticator <|.. AuthenticationIntegrationAuthenticator
    AuthenticationIntegrationAuthenticator ..> AuthenticationIntegrationRuntime : executes integrations
    AuthenticationIntegrationRuntime --> AuthenticationPluginManager : loads plugins
    AuthenticationIntegrationRuntime --> RoleMappingEvaluator : evaluates roles
    AuthenticationIntegrationAuthenticator ..> AuthenticateResponse : maps outcome
    FlightSessionsManager <|.. FlightSessionsInConnectPool
    FlightSessionsInConnectPool ..> AuthenticatorManager : applies outcome
    FlightSessionsInConnectPool ..> ConnectContext : initializes session
    FlightSessionsInConnectPool ..> ConnectPoolMgr : registers session
```

```mermaid
flowchart TD
    MYSQL["MySQL: MysqlProto"] --> WIRE["MySQL packet resolvers and TLS/certificate checks"]
    WIRE --> SHARED["AuthenticatorManager: shared login policy"]
    FLIGHT["Flight SQL: FlightBearerTokenAuthenticator"] --> KIND{"Credential for this RPC"}
    KIND -->|"Doris-issued bearer"| LOOKUP["Resolve a live FE-local Flight session"]
    KIND -->|"Initial Basic"| ADAPTER["FlightCredentialValidator: typed single-step request and listener transport"]
    ADAPTER --> SHARED
    SHARED --> BOUND{"Binding for this username and host?"}
    BOUND -->|"Yes"| SINGLE["Check credential and transport requirements, then try the bound integration only"]
    BOUND -->|"No"| PRIMARY["Try the configured primary authenticator or native password"]
    SINGLE --> INTEGRATIONS["AuthenticationIntegrationRuntime: match credentials and evaluate roles"]
    SINGLE -->|"Unsupported credential or transport"| ERROR["Protocol-specific failure response"]
    PRIMARY -->|"Success"| RESULT["AuthenticateResponse: resolved identity and any principal, roles or delegation"]
    PRIMARY -->|"Eligible fallback"| CHAIN["Try the configured integration chain"]
    PRIMARY -->|"Failed without fallback"| ERROR
    CHAIN --> INTEGRATIONS
    INTEGRATIONS -->|"Accepted"| MAP["Enforce bound external identity or map an existing user or permitted JIT identity"]
    MAP --> RESULT
    INTEGRATIONS -->|"Rejected"| ERROR
    RESULT --> GUARDS["Recheck bindings and account lock, enforce protocol certificate policy"]
    GUARDS -->|"Rejected"| ERROR
    GUARDS -->|"Accepted on MySQL"| MYSQLSESSION["Apply ConnectContext and use MySQL connection admission"]
    GUARDS -->|"Accepted on Flight"| FLIGHTSESSION["Apply ConnectContext, admit through ConnectPoolMgr and return FE-local bearer"]
```

### Testing

- **Previous FE run:** 102 targeted tests passed on the feature patch
with the previous master baseline. Tests covered MySQL selection,
bindings and lock checks, the Flight credential adapter, and session
admission.
- **Previous real ADBC OIDC run:** ADBC Flight SQL 1.13.0 authenticated
against an isolated FE using the OIDC plugin and a short-lived loopback
issuer with JWKS. A bound user could read only the granted table, a
wrong audience failed, and a JIT user received CEL-mapped SELECT without
creating a permanent account. A control run with the default FE rejected
plaintext OIDC. The positive run used a temporary loopback-only
transport exception that is absent from the PR. It reused an existing
4.1.5 BE.
- **Current run on the updated master baseline:** The same ten FE
classes passed all 102 tests with zero failures, errors, or skips on
`e46677d8008`. In a separate loopback-only smoke test against the
unmodified candidate FE, the MySQL client and ADBC Flight SQL 1.13.0
each logged in with the native account and read `query_timeout`. The
same ADBC client received `UNAUTHENTICATED` and the secure-transport
requirement for a typed OIDC login over plaintext.

### Notes for Reviewers

The two protocols share policy and outcome application. Their packet
exchange, transport signals, and error responses stay in their
respective adapters. The Flight bearer is issued after connection
admission and reused only to locate the live FE session.

### Release note

Arrow Flight SQL now applies the FE authentication policy for account
bindings, configured authenticators, and the authenticated identity and
roles used by the session.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes. Document Flight credential types
and transport requirements in the Doris website guide.
- Pre-submission status: Partially verified: Flight TLS, live IAM STS
integration, and a full distributable FE package were not verified.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: FE changes, targeted tests, and PR description
- Human review: not stated
27 files changed
tree: 5dba0081822d01f5f11199b0793de6331504a30f
  1. .claude/
  2. .github/
  3. .idea/
  4. be/
  5. bin/
  6. build-support/
  7. cloud/
  8. common/
  9. conf/
  10. contrib/
  11. dist/
  12. docker/
  13. docs/
  14. extension/
  15. fe/
  16. fe_plugins/
  17. fs_brokers/
  18. gensrc/
  19. hooks/
  20. pytest/
  21. regression-test/
  22. samples/
  23. task_executor_simulator/
  24. thirdparty/
  25. tools/
  26. ui/
  27. webroot/
  28. .asf.yaml
  29. .clang-format
  30. .clang-format-ignore
  31. .clang-tidy
  32. .clangd
  33. .dockerignore
  34. .editorconfig
  35. .gitattributes
  36. .gitignore
  37. .gitleaks.toml
  38. .gitmodules
  39. .licenserc.yaml
  40. .rat-excludes
  41. .shellcheckrc
  42. AGENTS.md
  43. build-for-release.sh
  44. build-plugin.sh
  45. build.sh
  46. build_profile.sh
  47. CODE_OF_CONDUCT.md
  48. CONTRIBUTING.md
  49. CONTRIBUTING_CN.md
  50. doap_Doris.rdf
  51. env.sh
  52. generated-source.sh
  53. LICENSE.txt
  54. NOTICE.txt
  55. post-build.sh
  56. README.md
  57. reset_submodule.sh
  58. run-be-ut.sh
  59. run-cloud-ut.sh
  60. run-fe-ut.sh
  61. run-fs-env-test.sh
  62. run-regression-test.sh
  63. SECURITY.md
  64. sonar-project.properties
  65. threat-model.md
README.md

🌍 Read this in other language

English • العربية • বাংলা • Deutsch • Español • فارسی • Français • हिन्दी • Bahasa Indonesia • Italiano • 日本語 • 한국어 • Polski • Português • Română • Русский • Slovenščina • ไทย • Türkçe • Українська • Tiếng Việt • 简体中文 • 繁體中文

Apache Doris

License GitHub release Slack EN doc CN doc

Official Website Quick Download


Apache Doris is an open-source, real-time analytics and search database built on MPP architecture. It provides fast SQL analytics, lakehouse query acceleration, and hybrid search across structured, text, and vector data.

Explore the official website for the latest product overview, use cases, ecosystem updates, blogs, and user stories. For version updates, see all release notes.

📈 Use Cases

Use CaseWhat it provides
Customer-Facing AnalyticsShip sub-second interactive analytics to external users.
Data WarehousingBuild one real-time warehouse across business domains.
ObservabilityAnalyze high-throughput logs, events, and metrics with SQL.
Doris for AIUse vector, text, JSON, and structured search in one SQL engine.

🚀 Core Capabilities

Apache Doris is built around three core capabilities. The website is the source of truth for detailed product descriptions and examples.

CapabilityWhat it provides
Real-Time AnalyticsStreaming ingestion, incremental transformation, and sub-second queries under high concurrency.
Lakehouse AnalyticsFast SQL analytics over open table formats such as Iceberg, Delta Lake, and Hudi.
Hybrid SearchSQL-native analytics across JSON, full-text, and vector data for AI and search workloads.

🔌 Ecosystem

Doris sits at the center of the modern data stack. It connects upstream databases, streaming systems, and lakehouse storage with downstream BI, AI, analytics, and observability tools.

For the latest ecosystem coverage, visit the official website and the connection and integration documentation.

👣 Get Started

🧱 Architecture

Apache Doris supports both compute-storage coupled and compute-storage decoupled deployments. In decoupled mode, stateless compute groups run over shared object storage, so you can scale compute on demand and isolate workloads.

Learn more in the deployment guide and deployment mode guide.

📣 Project Updates

ResourceWhat it provides
Community ReportWeekly updates on community activity, merged PRs, contributors, and feature progress.
Roadmap 2026The 2026 planning discussion for AI and hybrid search, query engine, storage, and data lake work.

🧩 Components

Doris provides connectors and tools for common data engineering workflows.

👨‍👩‍👧‍👦 Users

Apache Doris is used in production by thousands of companies worldwide across internet services, finance, retail, logistics, manufacturing, energy, telecommunications, AI, and other industries.

🙌 Contributors

Apache Doris graduated from the Apache Incubator and became an Apache Top-Level Project in June 2022. Thanks to all community contributors who help build Doris.

contrib graph

🌈 Community and Support

💬 Contact Us

🧰 Links

📜 License

Apache License, Version 2.0

Note Some licenses of the third-party dependencies are not compatible with Apache 2.0 License. So you need to disable some Doris features to comply with Apache 2.0 License. For details, refer to the thirdparty/LICENSE.txt