Skip to content

Commit

Permalink
Rename the property name to get rid of IDE warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtyomVancyan committed Sep 30, 2024
1 parent 75a5c65 commit 3d0d358
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/demonstration/router_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ def sim_auth(request: Request):
max_age=request.auth.expires,
expires=request.auth.expires,
httponly=request.auth.http,
samesite=request.auth.samesite,
samesite=request.auth.same_site,
)
return response
6 changes: 3 additions & 3 deletions src/fastapi_oauth2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class OAuth2Config:

enable_ssr: bool
allow_http: bool
samesite: str
same_site: str
jwt_secret: str
jwt_expires: int
jwt_algorithm: str
Expand All @@ -21,7 +21,7 @@ def __init__(
*,
enable_ssr: bool = True,
allow_http: bool = False,
samesite: str = "lax",
same_site: str = "lax",
jwt_secret: str = "",
jwt_expires: Union[int, str] = 900,
jwt_algorithm: str = "HS256",
Expand All @@ -31,7 +31,7 @@ def __init__(
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
self.enable_ssr = enable_ssr
self.allow_http = allow_http
self.samesite = samesite
self.same_site = same_site
self.jwt_secret = jwt_secret
self.jwt_expires = int(jwt_expires)
self.jwt_algorithm = jwt_algorithm
Expand Down
2 changes: 1 addition & 1 deletion src/fastapi_oauth2/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def token_redirect(self, request: Request, **kwargs) -> RedirectResponse:
expires=request.auth.expires,
secure=not request.auth.http,
httponly=True,
samesite=request.auth.samesite,
samesite=request.auth.same_site,
)
return response

Expand Down
4 changes: 2 additions & 2 deletions src/fastapi_oauth2/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class Auth(AuthCredentials):

ssr: bool
http: bool
samesite: str
secret: str
expires: int
same_site: str
algorithm: str
scopes: List[str]
provider: OAuth2Core
Expand Down Expand Up @@ -91,9 +91,9 @@ def __init__(
) -> None:
Auth.ssr = config.enable_ssr
Auth.http = config.allow_http
Auth.samesite = config.samesite
Auth.secret = config.jwt_secret
Auth.expires = config.jwt_expires
Auth.same_site = config.same_site
Auth.algorithm = config.jwt_algorithm
Auth.clients = {
client.backend.name: OAuth2Core(client)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def auth(request: Request):
max_age=request.auth.expires,
expires=request.auth.expires,
httponly=request.auth.http,
samesite=request.auth.samesite,
samesite=request.auth.same_site,
)
return response

Expand Down

0 comments on commit 3d0d358

Please sign in to comment.