You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-09 04:22:45 +03:00
Refactor the upstream link provider template logic
Also adds tests for new account registration through an upstream oauth2 provider
This commit is contained in:
@@ -22,6 +22,7 @@ use axum::{
|
||||
async_trait,
|
||||
body::{Bytes, HttpBody},
|
||||
extract::{FromRef, FromRequestParts},
|
||||
response::{IntoResponse, IntoResponseParts},
|
||||
};
|
||||
use cookie_store::{CookieStore, RawCookie};
|
||||
use futures_util::future::BoxFuture;
|
||||
@@ -31,7 +32,9 @@ use hyper::{
|
||||
Request, Response, StatusCode,
|
||||
};
|
||||
use mas_axum_utils::{
|
||||
cookies::CookieManager, http_client_factory::HttpClientFactory, ErrorWrapper,
|
||||
cookies::{CookieJar, CookieManager},
|
||||
http_client_factory::HttpClientFactory,
|
||||
ErrorWrapper,
|
||||
};
|
||||
use mas_i18n::Translator;
|
||||
use mas_keystore::{Encrypter, JsonWebKey, JsonWebKeySet, Keystore, PrivateKey};
|
||||
@@ -264,6 +267,11 @@ impl TestState {
|
||||
_ => panic!("Unexpected status code: {}", response.status()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an empty cookie jar
|
||||
pub fn cookie_jar(&self) -> CookieJar {
|
||||
self.cookie_manager.cookie_jar()
|
||||
}
|
||||
}
|
||||
|
||||
struct TestGraphQLState {
|
||||
@@ -631,6 +639,11 @@ impl CookieHelper {
|
||||
&url,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn import(&self, res: impl IntoResponseParts) {
|
||||
let response = (res, "").into_response();
|
||||
self.save_cookies(&response);
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Layer<S> for CookieHelper {
|
||||
|
Reference in New Issue
Block a user