Skip to content

Commit e9486b8

Browse files
authored
✨ Introduce Authx v1.0.0 (#454)
Introducing AuthX V1.0.0, our redesigned authentication system. This version incorporates numerous fresh functionalities and improvements aimed at enhancing security, usability, and performance. ## Core Functionality: - JWT encoding/decoding for application authentication - Automatic detection of JWTs in requests: - JWTs in headers - JWTs in cookies - JWTs in query strings - JWTs in JSON bodies - Implicit/explicit token refresh mechanism - Tracking the freshness state of tokens - Route protection: - Protection based on token type (access/refresh) - Protection based on token freshness - Partial route protection - Handling custom user logic for revoked token validation - Handling custom logic for token recipient retrieval (ORM, pydantic serialization...) - Providing FastAPI-compliant dependency injection API - Automatic error handling ## External Support: - Keeping profiler - Keeping Redis - Keeping Instrument - Keeping Metrics - Providing OAuth2 support
2 parents a050c97 + 0cfc6ff commit e9486b8

File tree

181 files changed

+5053
-8459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+5053
-8459
lines changed

.github/CODEOWNERS

-1
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

-5
This file was deleted.

.github/ISSUE_TEMPLATE/question.yml

-111
This file was deleted.

.github/dependabot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ updates:
55
- package-ecosystem: "github-actions"
66
directory: "/"
77
schedule:
8-
interval: "daily"
8+
interval: "weekly"
99
commit-message:
1010
prefix:
1111
# Python
1212
- package-ecosystem: "pip"
1313
directory: "/"
1414
schedule:
15-
interval: "daily"
15+
interval: "weekly"
1616
commit-message:
1717
prefix:

.github/workflows/cache.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: cleanup caches by a branch
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
cleanup:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v3
14+
15+
- name: Cleanup
16+
run: |
17+
gh extension install actions/gh-actions-cache
18+
19+
REPO=${{ github.repository }}
20+
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
21+
22+
echo "Fetching list of cache key"
23+
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
24+
25+
## Setting this to not fail the workflow while deleting cache keys.
26+
set +e
27+
echo "Deleting caches..."
28+
for cacheKey in $cacheKeysForPR
29+
do
30+
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
31+
done
32+
echo "Done"
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: {}
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.11"]
15+
fail-fast: false
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install Dependencies
24+
run: pip install -e .[lint]
25+
- uses: pre-commit/[email protected]
26+
with:
27+
extra_args: --all-files --verbose
28+
test:
29+
name: test on python ${{ matrix.python-version }}
30+
runs-on: ubuntu-latest
31+
services:
32+
redis:
33+
image: redis
34+
ports:
35+
- 6379:6379
36+
options: >-
37+
--health-cmd "redis-cli ping"
38+
--health-interval 10s
39+
--health-timeout 5s
40+
--health-retries 5
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
python-version: ["3.9", "3.10", "3.11"]
46+
47+
steps:
48+
- uses: actions/checkout@v3
49+
- name: Set up Python
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: ${{ matrix.python-version }}
53+
- uses: actions/cache@v3
54+
id: cache
55+
with:
56+
path: ${{ env.pythonLocation }}
57+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test
58+
- name: Install Dependencies
59+
if: steps.cache.outputs.cache-hit != 'true'
60+
run: pip install -e .[test,oauth2,profiler,metrics,session,cache]
61+
- name: Test
62+
env:
63+
ENV: test
64+
REDIS_URL: "redis://0.0.0.0:6379"
65+
run: pytest --cov=authx --cov-report=html -xv --color=yes --disable-warnings --cov-fail-under=80
66+
- name: Upload coverage
67+
uses: codecov/codecov-action@v3
68+
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
69+
check:
70+
if: always()
71+
needs: [lint, test]
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Decide whether the needed jobs succeeded or failed
75+
uses: re-actors/alls-green@release/v1
76+
with:
77+
jobs: ${{ toJSON(needs) }}

.github/workflows/lint.yml

-27
This file was deleted.

.github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
uses: actions/setup-python@v4
1919
with:
2020
python-version: "3.10"
21+
cache-dependency-path: pyproject.toml
2122
- uses: actions/cache@v3
2223
id: cache
2324
with:

.github/workflows/test.yml

-49
This file was deleted.

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,10 @@ venv.bak/
112112
# Project
113113
postgres-data
114114
.DS_Store
115+
116+
# Generated by tests
117+
authx_profiling_results.*
118+
*.db
119+
120+
# Generated by linting
121+
.ruff_cache/

.pre-commit-config.yaml

+3-14
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,19 @@ repos:
1212
- id: check-toml
1313
- id: check-yaml
1414
exclude: mkdocs.yml
15-
- repo: https://github.com/pycqa/isort
16-
rev: 5.12.0
17-
hooks:
18-
- id: isort
19-
name: isort (python)
20-
- id: isort
21-
name: isort (cython)
22-
types: [cython]
23-
- id: isort
24-
name: isort (pyi)
25-
types: [pyi]
2615
- repo: https://github.com/charliermarsh/ruff-pre-commit
27-
rev: v0.0.241
16+
rev: v0.0.270
2817
hooks:
2918
- id: ruff
3019
args:
3120
- --fix
3221
- repo: https://github.com/psf/black
33-
rev: 23.1.0
22+
rev: 23.3.0
3423
hooks:
3524
- id: black
3625
args: ["--target-version", "py39"]
3726
- repo: https://github.com/asottile/pyupgrade
38-
rev: v3.3.1
27+
rev: v3.4.0
3928
hooks:
4029
- id: pyupgrade
4130
args: [--py37-plus]

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Yasser Tahiri
3+
Copyright (c) 2021 to present Yezz LLC. and individual contributors.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)