Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Append additional parameters to the OAuth2 authorize endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sandhose committed Mar 1, 2024
1 parent 2fe758f commit ac22c75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/config/src/sections/upstream_oauth2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::{ops::Deref, collections::BTreeMap};
use std::{collections::BTreeMap, ops::Deref};

use async_trait::async_trait;
use mas_iana::{jose::JsonWebSignatureAlg, oauth::OAuthClientAuthenticationMethod};
Expand Down
11 changes: 10 additions & 1 deletion crates/handlers/src/upstream_oauth2/authorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,21 @@ pub(crate) async fn get(
};

// Build an authorization request for it
let (url, data) = mas_oidc_client::requests::authorization_code::build_authorization_url(
let (mut url, data) = mas_oidc_client::requests::authorization_code::build_authorization_url(
lazy_metadata.authorization_endpoint().await?.clone(),
data,
&mut rng,
)?;

// We do that in a block because params borrows url mutably
{
// Add any additional parameters to the query
let mut params = url.query_pairs_mut();
for (key, value) in &provider.additional_authorization_parameters {
params.append_pair(key, value);
}
}

let session = repo
.upstream_oauth_session()
.add(
Expand Down

0 comments on commit ac22c75

Please sign in to comment.