Skip to content

Commit f7e7173

Browse files
committed
feat: enhance OpenID configuration endpoint to use dynamic base URL and add debug logging
1 parent 14ae108 commit f7e7173

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/visualization/oidc.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
//! capabilities and configuration, including supported signing algorithms and endpoints.
1717
1818
use base64::Engine;
19+
use log::debug;
1920
use rocket::serde::json::{json, Json, Value};
2021
use rocket::{get, State};
2122
use serde::{Deserialize, Serialize};
2223

2324
use super::oxide_auth::OxideState;
25+
use super::server::ConnectionInfo;
2426
use crate::visualization::jwt_keys::JwkKeySet;
2527

2628
/// OpenID Connect Discovery Configuration
@@ -151,11 +153,12 @@ fn generate_openid_configuration(base_url: &str, state: &OxideState) -> OpenIdCo
151153
///
152154
/// JSON object containing OpenID Connect discovery configuration
153155
#[get("/.well-known/openid-configuration")]
154-
pub async fn openid_configuration(state: &State<OxideState>) -> Json<OpenIdConfiguration> {
155-
// In a production environment, you would want to get the base URL from the request
156-
// or configuration. For simplicity, we're using a hardcoded value here.
157-
let base_url = "http://localhost:8080";
158-
156+
pub async fn openid_configuration(
157+
state: &State<OxideState>,
158+
connection: ConnectionInfo<'_>,
159+
) -> Json<OpenIdConfiguration> {
160+
let base_url = &connection.base_url;
161+
debug!("Base URL for OpenID configuration: {}", base_url);
159162
// Generate the configuration document
160163
let config = generate_openid_configuration(base_url, state);
161164

0 commit comments

Comments
 (0)