CalvinKirs opened a new pull request, #71078:
URL: https://github.com/apache/doris/pull/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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]