|
16 | 16 | //! capabilities and configuration, including supported signing algorithms and endpoints. |
17 | 17 |
|
18 | 18 | use base64::Engine; |
| 19 | +use log::debug; |
19 | 20 | use rocket::serde::json::{json, Json, Value}; |
20 | 21 | use rocket::{get, State}; |
21 | 22 | use serde::{Deserialize, Serialize}; |
22 | 23 |
|
23 | 24 | use super::oxide_auth::OxideState; |
| 25 | +use super::server::ConnectionInfo; |
24 | 26 | use crate::visualization::jwt_keys::JwkKeySet; |
25 | 27 |
|
26 | 28 | /// OpenID Connect Discovery Configuration |
@@ -151,11 +153,12 @@ fn generate_openid_configuration(base_url: &str, state: &OxideState) -> OpenIdCo |
151 | 153 | /// |
152 | 154 | /// JSON object containing OpenID Connect discovery configuration |
153 | 155 | #[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); |
159 | 162 | // Generate the configuration document |
160 | 163 | let config = generate_openid_configuration(base_url, state); |
161 | 164 |
|
|
0 commit comments