Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Commit

Permalink
Updates status code references to use the Starlite implementations & …
Browse files Browse the repository at this point in the history
…Removes Python 3.7 Support (#18)

* Updates status code references to use the Starlite implementations

* remove 3.7 support
  • Loading branch information
cofin authored Nov 12, 2022
1 parent 6094729 commit 023b8f6
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
rev: v3.0.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
args: ["--py38-plus"]
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.1
hooks:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@
[1.4.1]

- updated authentication header and cookie to include the security scheme prefixed to the JWT token

[1.5.0]

- Updates references to starlette to use starlite
- remove Python `3.7` support
36 changes: 18 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "starlite-jwt"
version = "1.4.1"
version = "1.5.0"
description = "A JWT auth toolkit for Starlite"
authors = ["Na'aman Hirschfeld <nhirschfeld@gmail.com>"]
maintainers = [
Expand Down Expand Up @@ -39,7 +39,7 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
python = ">=3.8,<4.0"
starlite = ">=1.24.0"
python-jose = "*"
cryptography = "*"
Expand Down
2 changes: 1 addition & 1 deletion starlite_jwt/jwt_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
SecurityRequirement,
SecurityScheme,
)
from starlette.status import HTTP_201_CREATED
from starlite import ASGIConnection, Cookie, DefineMiddleware, Response
from starlite.enums import MediaType
from starlite.status_codes import HTTP_201_CREATED
from starlite.utils import AsyncCallable

from starlite_jwt.middleware import (
Expand Down
7 changes: 3 additions & 4 deletions starlite_jwt/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Awaitable, List, Optional, Union
from typing import TYPE_CHECKING, Awaitable, List, Literal, Optional, Union

from pydantic import BaseModel
from starlite import (
Expand All @@ -7,7 +7,6 @@
NotAuthorizedException,
)
from starlite.connection import ASGIConnection
from typing_extensions import Literal

from starlite_jwt.token import Token

Expand Down Expand Up @@ -56,7 +55,7 @@ async def authenticate_request(self, connection: "ASGIConnection[Any,Any,Any]")
and retrieve the user correlating to the token from the DB.
Args:
connection: An Starlette HTTPConnection instance.
connection: An Starlite HTTPConnection instance.
Returns:
AuthenticationResult
Expand Down Expand Up @@ -163,7 +162,7 @@ async def authenticate_request(self, connection: "ASGIConnection[Any,Any,Any]")
and retrieve the user correlating to the token from the DB.
Args:
connection: An Starlette HTTPConnection instance.
connection: An Starlite HTTPConnection instance.
Returns:
AuthenticationResult
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jwt_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import pytest
from hypothesis import given
from hypothesis.strategies import integers, none, one_of, sampled_from, text, timedeltas
from starlette.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED
from starlite import OpenAPIConfig, Request, Response, Starlite, get
from starlite.status_codes import HTTP_200_OK, HTTP_401_UNAUTHORIZED
from starlite.testing import create_test_client

from starlite_jwt import JWTAuth, JWTCookieAuth, OAuth2PasswordBearerAuth, Token
Expand Down

0 comments on commit 023b8f6

Please sign in to comment.