Merge pull request #832 from johannescpk/sdk/identity-assertion-session

fix(sdk): Can't assert identity without session
This commit is contained in:
Benjamin Kampmann
2022-07-12 12:25:46 +02:00
committed by GitHub
2 changed files with 7 additions and 3 deletions
+5 -2
View File
@@ -239,8 +239,11 @@ impl ClientBuilder {
/// All outgoing http requests will have a GET query key-value appended with
/// `user_id` being the key and the `user_id` from the `Session` being
/// the value. Will error if there's no `Session`. This is called
/// [identity assertion] in the Matrix Application Service Spec
/// the value. This is called [identity assertion] in the
/// Matrix Application Service Spec.
///
/// Requests that don't require authentication might not do identity
/// assertion.
///
/// [identity assertion]: https://spec.matrix.org/unstable/application-service-api/#identity-assertion
#[doc(hidden)]
+2 -1
View File
@@ -125,7 +125,8 @@ impl HttpClient {
}
trace!("Serializing request");
let request = if !config.assert_identity {
// We can't assert the identity without a session.
let request = if !config.assert_identity || session.is_none() {
let send_access_token = if auth_scheme == AuthScheme::None && !config.force_auth {
// Small optimization: Don't take the session lock if we know the auth token
// isn't going to be used anyways.