From da68dbfb0c442de41c851e597df0189bb0629aa0 Mon Sep 17 00:00:00 2001 From: Ali Aliyev Date: Thu, 11 Aug 2022 23:10:12 +0400 Subject: [PATCH] fix: allow `POST` method in `create_authorization_response` (#65) * fix: allow `POST` method in `create_authorization_response` fixes #64 * bump: 1.4.1 --- .pre-commit-config.yaml | 8 ++++---- aioauth/__version__.py | 2 +- aioauth/server.py | 2 +- setup.cfg | 4 ++-- tests/test_request_validator.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11762fc..85495a1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,12 +5,12 @@ fail_fast: true repos: - repo: https://github.com/psf/black - rev: 21.6b0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.2.0 hooks: - id: trailing-whitespace exclude: ^(setup\.cfg) @@ -20,12 +20,12 @@ repos: - id: detect-private-key - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910 + rev: v0.950 hooks: - id: mypy exclude: ^(docs/|setup\.py|tests/) - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 4.0.1 hooks: - id: flake8 diff --git a/aioauth/__version__.py b/aioauth/__version__.py index e59c6f1..876d6b2 100644 --- a/aioauth/__version__.py +++ b/aioauth/__version__.py @@ -1,7 +1,7 @@ __title__ = "aioauth" __description__ = "Asynchronous OAuth 2.0 framework for Python 3." __url__ = "https://github.com/aliev/aioauth" -__version__ = "1.4.0" +__version__ = "1.4.1" __author__ = "Ali Aliyev" __author_email__ = "ali@aliev.me" __license__ = "The MIT License (MIT)" diff --git a/aioauth/server.py b/aioauth/server.py index f8bbcba..8f567fa 100644 --- a/aioauth/server.py +++ b/aioauth/server.py @@ -324,7 +324,7 @@ async def authorize(request: fastapi.Request) -> fastapi.Response: Returns: response: An :py:class:`aioauth.responses.Response` object. """ - self.validate_request(request, [RequestMethod.GET]) + self.validate_request(request, [RequestMethod.GET, RequestMethod.POST]) response_type_list = enforce_list(request.query.response_type) response_type_classes = set() diff --git a/setup.cfg b/setup.cfg index 4448635..8c2a046 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.4.0 +current_version = 1.4.1 commit = True tag = True @@ -12,7 +12,7 @@ addopts = -s --strict-markers -vv --cache-clear --maxfail=1 --cov=aioauth --cov- [coverage:run] branch = True -omit = +omit = site-packages aioauth/__version__.py diff --git a/tests/test_request_validator.py b/tests/test_request_validator.py index b6d724a..796017c 100644 --- a/tests/test_request_validator.py +++ b/tests/test_request_validator.py @@ -39,7 +39,7 @@ async def test_insecure_transport_error(server: AuthorizationServer): async def test_allowed_methods(server: AuthorizationServer): request_url = "https://localhost" - request = Request(url=request_url, method=RequestMethod.POST) + request = Request(url=request_url, method="DELETE") # type: ignore response = await server.create_authorization_response(request) assert response.status_code == HTTPStatus.METHOD_NOT_ALLOWED