Skip to content

Commit a5cb479

Browse files
committed
in handle_oidc_callback use service_request.into_response
1 parent d70fac3 commit a5cb479

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/webserver/oidc.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,16 @@ impl<S> OidcService<S> {
193193
request: ServiceRequest,
194194
) -> LocalBoxFuture<Result<ServiceResponse<BoxBody>, Error>> {
195195
let client = Arc::clone(&self.client);
196-
let (http_req, _payload) = request.into_parts();
197-
let query_string = http_req.query_string().to_owned();
196+
198197
Box::pin(async move {
198+
let query_string = request.query_string();
199199
let result = Self::process_oidc_callback(&client, &query_string).await;
200200
match result {
201-
Ok(response) => Ok(ServiceResponse::new(http_req, response).map_into_boxed_body()),
201+
Ok(response) => Ok(request.into_response(response)),
202202
Err(e) => {
203203
log::error!("Failed to process OIDC callback: {}", e);
204-
Ok(ServiceResponse::new(
205-
http_req,
206-
HttpResponse::BadRequest().body("Authentication failed"),
207-
)
208-
.map_into_boxed_body())
204+
Ok(request
205+
.into_response(HttpResponse::BadRequest().body("Authentication failed")))
209206
}
210207
}
211208
})
@@ -230,8 +227,6 @@ impl<S> OidcService<S> {
230227
todo!("Use client.exchange_code() to get the token response");
231228
}
232229

233-
234-
235230
fn set_auth_cookie(
236231
response: &mut HttpResponse,
237232
token_response: &openidconnect::core::CoreTokenResponse,

0 commit comments

Comments
 (0)