Skip to content

SQL-76 Add pgwire password authentication to OIDC authenticator#34801

Merged
SangJunBak merged 5 commits intoMaterializeInc:mainfrom
SangJunBak:jun/add-password-auth-to-oidc
Feb 18, 2026
Merged

SQL-76 Add pgwire password authentication to OIDC authenticator#34801
SangJunBak merged 5 commits intoMaterializeInc:mainfrom
SangJunBak:jun/add-password-auth-to-oidc

Conversation

@SangJunBak
Copy link
Copy Markdown
Contributor

@SangJunBak SangJunBak commented Jan 22, 2026

see commit messages for details, starting from commit "Add password fallback for OIDC pgwire". Commits before are. being reviewed in #34690.

Will do http pgwire password authentication in a followup PR.

Motivation

Tips for reviewer

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch 7 times, most recently from a8d789b to aed6472 Compare January 27, 2026 19:01
@SangJunBak SangJunBak changed the title Jun/add password auth to OIDC SQL-76 Add pgwire password authentication to OIDC authenticator Jan 28, 2026
@SangJunBak SangJunBak marked this pull request as ready for review January 28, 2026 03:40
@SangJunBak SangJunBak requested review from a team and ggevay as code owners January 28, 2026 03:40
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch from aed6472 to 1ccd67a Compare January 28, 2026 06:56
@SangJunBak SangJunBak requested review from a team, aljoscha and teskje as code owners January 28, 2026 06:56
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch from 1ccd67a to 0d5b665 Compare January 28, 2026 07:09
@SangJunBak SangJunBak removed request for a team, aljoscha, ggevay and teskje January 28, 2026 14:33
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch from 0d5b665 to c04b2aa Compare January 28, 2026 14:53
@SangJunBak SangJunBak requested a review from teskje January 28, 2026 15:43
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch 2 times, most recently from 047394c to 5de9377 Compare February 9, 2026 18:33
- Add external_metadata_rx() method to OidcAuthSessionHandle trait with default None impl
This allows us to create a helper functions for anything implementing OidcAuthenticator.

- Update Authenticator::Oidc to use named fields: {oidc, password}
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch from 5de9377 to 31359cd Compare February 9, 2026 20:16
- Add authenticate_with_oidc_token for token-based auth (Frontegg/OIDC JWT)
- Add authenticate_with_password for password-based auth
- Enables tests to pass connection-level options like --oidc_auth_enabled
- Verifies that when oidc_auth_enabled is not set in the connection options, the OIDC authenticator falls back to password authentication.
Call stacks above the critical recursion can grow as we add code elsewhere in the system
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch from 31359cd to b04753d Compare February 9, 2026 22:09
Copy link
Copy Markdown
Contributor

@teskje teskje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me.

I'm a bit unhappy with adding password auth as a special case for OIDC auth, ideally we would leave the concerns separated and leave the password auth to the password authenticator. Would it be difficult to move the dispatching on the auth method one level up and just use the password authenticator when OIDC is disabled via the option?

Comment thread src/authenticator/src/lib.rs Outdated
Oidc(GenericOidcAuthenticator),
Oidc {
oidc: GenericOidcAuthenticator,
password: AdapterClient,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call this adapter_client? I think you name it password because it's used for password auth, but I was confused initially thinking this field stores a password instead.

Copy link
Copy Markdown
Contributor Author

@SangJunBak SangJunBak Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! Implemented it in my latest commit.

# the query planner and optimizer.

# 475 UNIONs
# 418 UNIONs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

@SangJunBak SangJunBak requested a review from teskje February 13, 2026 19:36
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch from c00c9cb to 7d99ff9 Compare February 13, 2026 20:23
Copy link
Copy Markdown
Contributor

@teskje teskje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just a couple minor comments.

Comment thread src/environmentd/src/lib.rs Outdated
// We can only send the Frontegg, OIDC, and None variants immediately.
// The Password variant requires an adapter client.
// We can only send the Frontegg and None variants immediately.
// The Password and Oidc variants require an adapter client.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oidc doesn't require an adapter client anymore, right?

Comment thread src/pgwire/src/protocol.rs Outdated
frontegg: Option<FronteggAuthenticator>,
oidc: Option<GenericOidcAuthenticator>,
adapter_client: mz_adapter::Client,
// If oidc_auth_enabled exists as an option in the connection options,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this comment got cut off?

Comment thread src/pgwire/src/protocol.rs Outdated
AuthenticatorKind::Password => Authenticator::Password(adapter_client),
AuthenticatorKind::Sasl => Authenticator::Sasl(adapter_client),
AuthenticatorKind::Oidc => {
let oidc = oidc.expect("OIDC authenticator should exist with AuthenticatorKind::Oidc");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Move this into the if branch, closer to its usage.

By choosing the authenticator on connection, we can keep password authentication tied to AuthenticatorKind::Password. We need to do it on connection because it depends on the oidc_auth_enabled value from 'options' in the connection parameters
@SangJunBak SangJunBak force-pushed the jun/add-password-auth-to-oidc branch from 7d99ff9 to 531b22e Compare February 18, 2026 04:44
@SangJunBak SangJunBak enabled auto-merge (squash) February 18, 2026 04:44
@SangJunBak SangJunBak merged commit b47068b into MaterializeInc:main Feb 18, 2026
133 checks passed
patrickwwbutler pushed a commit to patrickwwbutler/materialize that referenced this pull request Feb 19, 2026
…rializeInc#34801)

<!--
Describe the contents of the PR briefly but completely.

If you write detailed commit messages, it is acceptable to copy/paste
them
here, or write "see commit messages for details." If there is only one
commit
in the PR, GitHub will have already added its commit message above.
-->
see commit messages for details, starting from commit "[Add password
fallback for OIDC
pgwire](MaterializeInc@e3bbf7a)".
Commits before are. being reviewed in
MaterializeInc#34690.

Will do http pgwire password authentication in a followup PR. 

### Motivation

<!--
Which of the following best describes the motivation behind this PR?

  * This PR fixes a recognized bug.

    [Ensure issue is linked somewhere.]

  * This PR adds a known-desirable feature.

    [Ensure issue is linked somewhere.]

  * This PR fixes a previously unreported bug.

    [Describe the bug in detail, as if you were filing a bug report.]

  * This PR adds a feature that has not yet been specified.

[Write a brief specification for the feature, including justification
for its inclusion in Materialize, as if you were writing the original
     feature specification.]

   * This PR refactors existing code.

[Describe what was wrong with the existing code, if it is not obvious.]
-->

### Tips for reviewer

<!--
Leave some tips for your reviewer, like:

    * The diff is much smaller if viewed with whitespace hidden.
    * [Some function/module/file] deserves extra attention.
* [Some function/module/file] is pure code movement and only needs a
skim.

Delete this section if no tips.
-->

### Checklist

- [ ] This PR has adequate test coverage / QA involvement has been duly
considered. ([trigger-ci for additional test/nightly
runs](https://trigger-ci.dev.materialize.com/))
- [ ] This PR has an associated up-to-date [design
doc](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/README.md),
is a design doc
([template](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/00000000_template.md)),
or is sufficiently small to not require a design.
  <!-- Reference the design in the description. -->
- [ ] If this PR evolves [an existing `$T ⇔ Proto$T`
mapping](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/command-and-response-binary-encoding.md)
(possibly in a backwards-incompatible way), then it is tagged with a
`T-proto` label.
- [ ] If this PR will require changes to cloud orchestration or tests,
there is a companion cloud PR to account for those changes that is
tagged with the release-blocker label
([example](MaterializeInc/cloud#5021)).
<!-- Ask in #team-cloud on Slack if you need help preparing the cloud
PR. -->
- [ ] If this PR includes major [user-facing behavior
changes](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/guide-changes.md#what-changes-require-a-release-note),
I have pinged the relevant PM to schedule a changelog post.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants