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

Commit 7304c9d

Browse files
committed
Append additional parameters to the OAuth2 authorize endpoint
1 parent 767cf50 commit 7304c9d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

crates/config/src/sections/upstream_oauth2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use std::{ops::Deref, collections::BTreeMap};
15+
use std::{collections::BTreeMap, ops::Deref};
1616

1717
use async_trait::async_trait;
1818
use mas_iana::{jose::JsonWebSignatureAlg, oauth::OAuthClientAuthenticationMethod};

crates/handlers/src/upstream_oauth2/authorize.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,21 @@ pub(crate) async fn get(
107107
};
108108

109109
// Build an authorization request for it
110-
let (url, data) = mas_oidc_client::requests::authorization_code::build_authorization_url(
110+
let (mut url, data) = mas_oidc_client::requests::authorization_code::build_authorization_url(
111111
lazy_metadata.authorization_endpoint().await?.clone(),
112112
data,
113113
&mut rng,
114114
)?;
115115

116+
// We do that in a block because params borrows url mutably
117+
{
118+
// Add any additional parameters to the query
119+
let mut params = url.query_pairs_mut();
120+
for (key, value) in &provider.additional_authorization_parameters {
121+
params.append_pair(key, value);
122+
}
123+
}
124+
116125
let session = repo
117126
.upstream_oauth_session()
118127
.add(

0 commit comments

Comments
 (0)