1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-21 23:00:50 +03:00

Append additional parameters to the OAuth2 authorize endpoint

This commit is contained in:
Quentin Gliech
2024-03-01 12:53:17 +01:00
parent 25fbbf96b9
commit 3251c5896c
2 changed files with 11 additions and 2 deletions

View File

@@ -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};

View File

@@ -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(