mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-26 14:45:17 -04:00
Fix incorrectly sending authentication tokens to application service as headers (#14301)
This commit is contained in:
parent
23fa636ed7
commit
04fd6221de
3 changed files with 13 additions and 8 deletions
|
@ -11,7 +11,7 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
from typing import Any, List, Mapping
|
||||
from typing import Any, List, Mapping, Sequence, Union
|
||||
from unittest.mock import Mock
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactor
|
||||
|
@ -70,13 +70,15 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
|
|||
self.request_url = None
|
||||
|
||||
async def get_json(
|
||||
url: str, args: Mapping[Any, Any], headers: Mapping[Any, Any]
|
||||
url: str,
|
||||
args: Mapping[Any, Any],
|
||||
headers: Mapping[Union[str, bytes], Sequence[Union[str, bytes]]],
|
||||
) -> List[JsonDict]:
|
||||
# Ensure the access token is passed as both a header and query arg.
|
||||
if not headers.get("Authorization") or not args.get(b"access_token"):
|
||||
raise RuntimeError("Access token not provided")
|
||||
|
||||
self.assertEqual(headers.get("Authorization"), f"Bearer {TOKEN}")
|
||||
self.assertEqual(headers.get("Authorization"), [f"Bearer {TOKEN}"])
|
||||
self.assertEqual(args.get(b"access_token"), TOKEN)
|
||||
self.request_url = url
|
||||
if url == URL_USER:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue