Skip to content

Commit

Permalink
Merge pull request #4 from sijokun/dev
Browse files Browse the repository at this point in the history
Version 0.6
  • Loading branch information
sijokun committed Aug 3, 2023
2 parents 172389a + c280b9a commit a61adb6
Show file tree
Hide file tree
Showing 34 changed files with 1,211 additions and 905 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@ on:
types: [created]

jobs:
deploy:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.11
uses: actions/setup-python@v1
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.17
with:
python-version: 3.11
- name: Install pypa/build
run: python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
30 changes: 13 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,23 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
fail-fast: false

matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Flit
run: pip install flit
- name: Install Dependencies
run: flit install --symlink
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.4.2
- name: Install project
run: poetry install
- name: Test
run: bash scripts/tests.sh
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --service=github
run: poetry run poe test
18 changes: 10 additions & 8 deletions async_fastapi_jwt_auth/auth_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from async_fastapi_jwt_auth.config import LoadConfig
from pydantic import ValidationError
from typing import Callable, List
from datetime import timedelta
from typing import Callable, List

from pydantic import ValidationError

from async_fastapi_jwt_auth.config import LoadConfig


class AuthConfig:
_token = None
_token_location = {'headers'}
_token_location = {"headers"}

_secret_key = None
_public_key = None
Expand All @@ -18,7 +20,7 @@ class AuthConfig:
_decode_issuer = None
_decode_audience = None
_denylist_enabled = False
_denylist_token_checks = {'access', 'refresh'}
_denylist_token_checks = {"access", "refresh"}
_header_name = "Authorization"
_header_type = "Bearer"
_token_in_denylist_callback = None
Expand All @@ -43,15 +45,15 @@ class AuthConfig:
_refresh_csrf_cookie_path = "/"
_access_csrf_header_name = "X-CSRF-Token"
_refresh_csrf_header_name = "X-CSRF-Token"
_csrf_methods = {'POST', 'PUT', 'PATCH', 'DELETE'}
_csrf_methods = {"POST", "PUT", "PATCH", "DELETE"}

@property
def jwt_in_cookies(self) -> bool:
return 'cookies' in self._token_location
return "cookies" in self._token_location

@property
def jwt_in_headers(self) -> bool:
return 'headers' in self._token_location
return "headers" in self._token_location

@classmethod
def load_config(cls, settings: Callable[..., List[tuple]]):
Expand Down
Loading

0 comments on commit a61adb6

Please sign in to comment.