Skip to content

Commit 6c1c9a2

Browse files
authored
fix: Construction of OIDC endpoint when rootPath has a trailing slash (#569)
* fix: Calculation of OIDC endpoint when rootPath has no trailing slash * changelog * fix URL calculation * refactor * Naming feedback from review * Rename known_config_url -> well_known_config_url * cargo fmt
1 parent 9fc2136 commit 6c1c9a2

File tree

10 files changed

+232
-31
lines changed

10 files changed

+232
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
### Fixed
2020

2121
- Invalid `SupersetCluster`, `DruidConnection` or `AuthenticationClass` objects don't stop the operator from reconciling ([#551]).
22+
- Fix OIDC endpoint construction in case the `rootPath` does have a trailing slash ([#569]).
2223

2324
[#528]: https://github.com/stackabletech/superset-operator/pull/528
2425
[#530]: https://github.com/stackabletech/superset-operator/pull/530
2526
[#549]: https://github.com/stackabletech/superset-operator/pull/549
2627
[#551]: https://github.com/stackabletech/superset-operator/pull/551
28+
[#569]: https://github.com/stackabletech/superset-operator/pull/569
2729

2830
## [24.7.0] - 2024-07-24
2931

Cargo.lock

Lines changed: 91 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ fnv = "1.0"
1717
futures = { version = "0.3", features = ["compat"] }
1818
indoc = "2.0"
1919
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
20+
rstest = "0.23"
2021
serde = { version = "1.0", features = ["derive"] }
2122
serde_json = "1.0"
2223
serde_yaml = "0.9"
2324
snafu = "0.8"
24-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.80.0" }
25+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.82.0" }
2526
strum = { version = "0.26", features = ["derive"] }
2627
tokio = { version = "1.40", features = ["full"] }
2728
tracing = "0.1"
2829

2930
# [patch."https://github.com/stackabletech/operator-rs.git"]
3031
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
32+
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }

crate-hashes.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/crd/src/authentication.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub enum SupersetAuthenticationClassResolved {
141141
},
142142
Oidc {
143143
provider: oidc::AuthenticationProvider,
144-
oidc: oidc::ClientAuthenticationOptions<()>,
144+
client_auth_options: oidc::ClientAuthenticationOptions<()>,
145145
},
146146
}
147147

@@ -310,7 +310,7 @@ impl SupersetClientAuthenticationDetailsResolved {
310310

311311
Ok(SupersetAuthenticationClassResolved::Oidc {
312312
provider: provider.to_owned(),
313-
oidc: auth_details
313+
client_auth_options: auth_details
314314
.common
315315
.oidc_or_error(auth_class_name)
316316
.context(OidcConfigurationInvalidSnafu)?
@@ -415,7 +415,7 @@ mod tests {
415415
oidc:
416416
hostname: first.oidc.server
417417
port: 443
418-
rootPath: /realms/main
418+
rootPath: /realms/main/
419419
principalClaim: preferred_username
420420
scopes:
421421
- openid
@@ -436,7 +436,7 @@ mod tests {
436436
provider:
437437
oidc:
438438
hostname: second.oidc.server
439-
rootPath: /realms/test
439+
rootPath: /realms/test/
440440
principalClaim: preferred_username
441441
scopes:
442442
- openid
@@ -453,7 +453,7 @@ mod tests {
453453
provider: oidc::AuthenticationProvider::new(
454454
HostName::try_from("first.oidc.server".to_string()).unwrap(),
455455
Some(443),
456-
"/realms/main".into(),
456+
"/realms/main/".into(),
457457
TlsClientDetails {
458458
tls: Some(Tls {
459459
verification: TlsVerification::Server(TlsServerVerification {
@@ -465,7 +465,7 @@ mod tests {
465465
vec!["openid".into(), "email".into(), "profile".into()],
466466
Some(IdentityProviderHint::Keycloak)
467467
),
468-
oidc: oidc::ClientAuthenticationOptions {
468+
client_auth_options: oidc::ClientAuthenticationOptions {
469469
client_credentials_secret_ref: "superset-oidc-client1".into(),
470470
extra_scopes: vec!["groups".into()],
471471
product_specific_fields: ()
@@ -475,13 +475,13 @@ mod tests {
475475
provider: oidc::AuthenticationProvider::new(
476476
HostName::try_from("second.oidc.server".to_string()).unwrap(),
477477
None,
478-
"/realms/test".into(),
478+
"/realms/test/".into(),
479479
TlsClientDetails { tls: None },
480480
"preferred_username".into(),
481481
vec!["openid".into(), "email".into(), "profile".into()],
482482
None
483483
),
484-
oidc: oidc::ClientAuthenticationOptions {
484+
client_auth_options: oidc::ClientAuthenticationOptions {
485485
client_credentials_secret_ref: "superset-oidc-client2".into(),
486486
extra_scopes: Vec::new(),
487487
product_specific_fields: ()

rust/operator-binary/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ strum.workspace = true
2424
tokio.workspace = true
2525
tracing.workspace = true
2626

27+
[dev-dependencies]
28+
rstest.workspace = true
29+
2730
[build-dependencies]
2831
built.workspace = true

0 commit comments

Comments
 (0)