From 3d8ee620875085ae7e8d7ef31f4f8e3738cfdca1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 7 Feb 2022 18:49:59 +0300 Subject: style(rust): Format all Rust code with rustfmt Change-Id: Iab7e00cc26a4f9727d3ab98691ef379921a33052 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5240 Tested-by: BuildkiteCI Reviewed-by: kanepyork Reviewed-by: Profpatsch Reviewed-by: grfn Reviewed-by: tazjin --- web/converse/src/oidc.rs | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'web/converse/src/oidc.rs') diff --git a/web/converse/src/oidc.rs b/web/converse/src/oidc.rs index 9f566c04a71a..75e3eabc88f2 100644 --- a/web/converse/src/oidc.rs +++ b/web/converse/src/oidc.rs @@ -22,12 +22,12 @@ //! Currently Converse only supports a single OIDC provider. Note that //! this has so far only been tested with Office365. -use actix::prelude::*; use crate::errors::*; +use actix::prelude::*; use crimp::Request; +use curl::easy::Form; use url::Url; use url_serde; -use curl::easy::Form; /// This structure represents the contents of an OIDC discovery /// document. @@ -114,20 +114,30 @@ impl Handler for OidcExecutor { debug!("Received OAuth2 code, requesting access_token"); let mut form = Form::new(); - form.part("client_id").contents(&self.client_id.as_bytes()) - .add().expect("critical error: invalid form data"); - - form.part("client_secret").contents(&self.client_secret.as_bytes()) - .add().expect("critical error: invalid form data"); - - form.part("grant_type").contents("authorization_code".as_bytes()) - .add().expect("critical error: invalid form data"); - - form.part("code").contents(&msg.0.code.as_bytes()) - .add().expect("critical error: invalid form data"); - - form.part("redirect_uri").contents(&self.redirect_uri.as_bytes()) - .add().expect("critical error: invalid form data"); + form.part("client_id") + .contents(&self.client_id.as_bytes()) + .add() + .expect("critical error: invalid form data"); + + form.part("client_secret") + .contents(&self.client_secret.as_bytes()) + .add() + .expect("critical error: invalid form data"); + + form.part("grant_type") + .contents("authorization_code".as_bytes()) + .add() + .expect("critical error: invalid form data"); + + form.part("code") + .contents(&msg.0.code.as_bytes()) + .add() + .expect("critical error: invalid form data"); + + form.part("redirect_uri") + .contents(&self.redirect_uri.as_bytes()) + .add() + .expect("critical error: invalid form data"); let response = Request::post(&self.oidc_config.token_endpoint) .user_agent(concat!("converse-", env!("CARGO_PKG_VERSION")))? @@ -142,7 +152,8 @@ impl Handler for OidcExecutor { .user_agent(concat!("converse-", env!("CARGO_PKG_VERSION")))? .header("Authorization", &bearer)? .send()? - .as_json()?.body; + .as_json()? + .body; Ok(Author { name: user.name, -- cgit 1.4.1