Skip to content

Add basic-auth (username/password) login for Dremio Software deployments - #126

Open
cq2wgwtzb5-lgtm wants to merge 1 commit into
dremio:mainfrom
cq2wgwtzb5-lgtm:feature/basic-auth-software-login
Open

Add basic-auth (username/password) login for Dremio Software deployments#126
cq2wgwtzb5-lgtm wants to merge 1 commit into
dremio:mainfrom
cq2wgwtzb5-lgtm:feature/basic-auth-software-login

Conversation

@cq2wgwtzb5-lgtm

Copy link
Copy Markdown

Closes #125

What

Adds an optional dremio.basic_auth configuration block for Dremio Software deployments that cannot issue PATs (e.g. Community edition — the PAT support key is absent and token endpoints 404 there):

dremio:
  uri: https://your-dremio-instance:9047
  basic_auth:
    username: alice
    password: "@~/tokens/dremio.password"  # or a direct value

How

  • config/settings.py — new BasicAuth model mirroring OAuth2 (username, password with the existing @-file resolution convention, expiry tracking via has_expired); Dremio.basic_auth field + basic_auth_configured property (guarded off for Cloud).
  • api/basic_auth.py (new) — exchanges credentials for a session token via POST /apiv2/login; SessionToken.update_settings() installs it as the effective token, with a 5-minute safety margin ahead of the server-reported expiry. Stdlib urllib only, no new dependencies.
  • api/transport.py — one branch in DremioAsyncHttpClient.__init__, exactly parallel to the OAuth branch: if basic auth is configured and there is no valid token (or the session expired), log in and refresh. No changes to header construction — the REST API accepts session tokens as Bearer tokens.

PAT and Dremio Cloud behavior are unchanged; if both pat and basic_auth are configured, the PAT wins.

Testing

  • 5 new unit tests (tests/api/test_basic_auth.py): settings parsing, @-file password resolution + serialization keeping the reference (not the resolved secret), Cloud guard, mocked login flow updating settings, expiry detection.
  • Full suite: 353 passed, 44 skipped; black clean.
  • Live verification: dremio-mcp-server tools invoke -t RunSqlQuery end-to-end against a real Dremio Software Community deployment using only username/password.

Docs

docs/settings.md gains a "Basic auth (Dremio Software without PAT support)" section.

🤖 Generated with Claude Code

Dremio Software Community edition cannot issue PATs, which makes the MCP
server unusable there: the PAT support key is absent and token endpoints
return 404. This adds an optional dremio.basic_auth config block
(username + password, '@' file references supported) that exchanges the
credentials for a session token via POST /apiv2/login and installs it as
the effective token (the REST API accepts session tokens as Bearer
tokens). The token is refreshed automatically ahead of its
server-reported expiry, mirroring the existing OAuth2 pattern. PAT and
Dremio Cloud behavior are unchanged; PAT wins if both are configured.

Verified against a live Dremio Software Community deployment
(RunSqlQuery end-to-end) plus unit tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support Dremio Software deployments that cannot issue PATs (basic-auth login)

3 participants