You've already forked authentication-service
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:
@@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use std::{ops::Deref, collections::BTreeMap};
|
use std::{collections::BTreeMap, ops::Deref};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use mas_iana::{jose::JsonWebSignatureAlg, oauth::OAuthClientAuthenticationMethod};
|
use mas_iana::{jose::JsonWebSignatureAlg, oauth::OAuthClientAuthenticationMethod};
|
||||||
|
|||||||
@@ -107,12 +107,21 @@ pub(crate) async fn get(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Build an authorization request for it
|
// 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(),
|
lazy_metadata.authorization_endpoint().await?.clone(),
|
||||||
data,
|
data,
|
||||||
&mut rng,
|
&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
|
let session = repo
|
||||||
.upstream_oauth_session()
|
.upstream_oauth_session()
|
||||||
.add(
|
.add(
|
||||||
|
|||||||
Reference in New Issue
Block a user