Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/environmentd/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,8 @@ async fn auth(
include_www_authenticate_header,
});
}
// TODO (Oidc): Implement password auth flow
// for this authenticator variant.
Authenticator::Oidc(oidc) => match creds {
Some(Credentials::Token { token }) => {
// Validate JWT token
Expand Down
31 changes: 11 additions & 20 deletions src/environmentd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ pub struct Config {
pub tls_reload_certs: ReloadTrigger,
/// Password of the mz_system user.
pub external_login_password_mz_system: Option<Password>,
/// Frontegg JWT authentication configuration.
/// Frontegg JWT authenticator.
pub frontegg: Option<FronteggAuthenticator>,
/// OIDC JWT authentication configuration.
/// OIDC authenticator.
pub oidc: Option<GenericOidcAuthenticator>,
/// Origins for which cross-origin resource sharing (CORS) for HTTP requests
/// is permitted.
Expand Down Expand Up @@ -277,24 +277,15 @@ impl Listener<SqlListenerConfig> {
TlsMode::Allow
},
});
let authenticator = match self.config.authenticator_kind {
AuthenticatorKind::Frontegg => Authenticator::Frontegg(
frontegg.expect("Frontegg args are required with AuthenticatorKind::Frontegg"),
),
AuthenticatorKind::Password => Authenticator::Password(adapter_client.clone()),
AuthenticatorKind::Sasl => Authenticator::Sasl(adapter_client.clone()),
AuthenticatorKind::Oidc => Authenticator::Oidc(
oidc.expect("OIDC config is required with AuthenticatorKind::Oidc"),
),
AuthenticatorKind::None => Authenticator::None,
};

task::spawn(|| format!("{}_sql_server", label), {
let sql_server = mz_pgwire::Server::new(mz_pgwire::Config {
label,
tls,
adapter_client,
authenticator,
authenticator_kind: self.config.authenticator_kind,
frontegg,
oidc,
metrics,
active_connection_counter,
helm_chart_version,
Expand Down Expand Up @@ -391,18 +382,13 @@ impl Listeners {
let (authenticator_none_tx, authenticator_none_rx) = oneshot::channel();
let authenticator_none_rx = authenticator_none_rx.shared();

// We can only send the Frontegg, OIDC, and None variants immediately.
// We can only send the Frontegg and None variants immediately.
// The Password variant requires an adapter client.
if let Some(frontegg) = &config.frontegg {
authenticator_frontegg_tx
.send(Arc::new(Authenticator::Frontegg(frontegg.clone())))
.expect("rx known to be live");
}
if let Some(oidc) = &config.oidc {
authenticator_oidc_tx
.send(Arc::new(Authenticator::Oidc(oidc.clone())))
.expect("rx known to be live");
}
authenticator_none_tx
.send(Arc::new(Authenticator::None))
.expect("rx known to be live");
Expand Down Expand Up @@ -824,6 +810,11 @@ impl Listeners {
authenticator_password_tx
.send(Arc::new(Authenticator::Password(adapter_client.clone())))
.expect("rx known to be live");
if let Some(oidc) = &config.oidc {
authenticator_oidc_tx
.send(Arc::new(Authenticator::Oidc(oidc.clone())))
.expect("rx known to be live");
}
adapter_client_tx
.send(adapter_client.clone())
.expect("internal HTTP server should not drop first");
Expand Down
Loading