Ready to use and customizable Authentications and Authorisation management for FastAPI ⚡

Overview

AuthenticationX 💫

authx

Ready-to-use and customizable Authentications and Oauth2 management for FastAPI

Local Tests Docker Tests codecov PyPI version Downloads Downloads Language framework Star Badge Pypi Libraries.io dependency status for latest release


Source Code: https://github.com/yezz123/AuthX

Documentation: https://authx.yezz.codes/


Add a Fully registration and authentication or authorization system to your FastAPI project. AuthX is designed to be as customizable and adaptable as possible.

Note: This is a beta version of AuthX.

Features 🔧

  • Support Python 3.8+.
  • Extensible base user model.
  • Ready-to-use register, login, reset password and verify e-mail routes.
  • Ready-to-use Social login and Oauth2 routes. (now with Google, Facebook)
    • Soon with Microsoft, Twitter, Github, etc.
    • Ready-to-use social OAuth2 login flow
  • Tested Project on Docker.
  • Dependency callable to inject current user in route
  • Pluggable password validation
    • Using Captcha Service.
  • Using Email Service. (SMTP)
  • Extensible Error Handling
  • High level API to manage users, roles and permissions
  • Using Redis as a session store & cache.
  • Customizable database backend:
  • Multiple customizable authentication backend:
    • JWT authentication backend included
    • Soon to be included Cookie authentication backend
  • Full OpenAPI schema support, even with several authentication backend.
  • Provide a Docstring for each class and function.

Note: Check Release Notes.

Project using 🚀

from fastapi import FastAPI
from authx import Authentication

app = FastAPI()
auth = Authentication()

# Define your routes here
app.include_router(auth.auth_router, prefix="/api/users")
app.include_router(auth.social_router, prefix="/auth")
app.include_router(auth.password_router, prefix="/api/users")
app.include_router(auth.admin_router, prefix="/api/users")
app.include_router(auth.search_router, prefix="/api/users")

Startup 🏁

from fastapi import FastAPI
from authx import Authentication
from authx.database import MongoDBBackend, RedisBackend

app = FastAPI()
auth = Authentication()

app.include_router(auth.auth_router, prefix="/api/users")
app.include_router(auth.social_router, prefix="/auth")
app.include_router(auth.password_router, prefix="/api/users")
app.include_router(auth.admin_router, prefix="/api/users")
app.include_router(auth.search_router, prefix="/api/users")

# Set MongoDB and Redis Cache
auth.set_cache(RedisBackend) # aioredis client
auth.set_database(MongoDBBackend) # motor client

Dependency injections 📦

from fastapi import FastAPI,APIRouter, Depends
from authx import User, Authentication
from authx.database import MongoDBBackend, RedisBackend

app = FastAPI()
auth = Authentication()
router = APIRouter()


app.include_router(auth.auth_router, prefix="/api/users")
app.include_router(auth.social_router, prefix="/auth")
app.include_router(auth.password_router, prefix="/api/users")
app.include_router(auth.admin_router, prefix="/api/users")
app.include_router(auth.search_router, prefix="/api/users")

# Set MongoDB and Redis Cache
auth.set_cache(RedisBackend) # aioredis client
auth.set_database(MongoDBBackend) # motor client

# Set Anonymous User
@router.get("/anonym")
def anonym_test(user: User = Depends(auth.get_user)):
    pass

# Set Authenticated User
@router.get("/user")
def user_test(user: User = Depends(auth.get_authenticated_user)):
    pass

# Set Admin User
@router.get("/admin", dependencies=[Depends(auth.admin_required)])
def admin_test():
    pass

Dependency injections only 📦

from authx import authx
from authx.database import RedisBackend

auth = authx(#Provide Config)

# startup
auth.set_cache(RedisBackend) # aioredis

Development 🚧

Setup environment 📦

You should create a virtual environment and activate it:

python -m venv venv/
source venv/bin/activate

And then install the development dependencies:

pip install -r requirements.dev.txt

Run tests 🌝

You can run all the tests with:

make docker-test

The command will start a MongoDB container for the related unit tests. So you should have Docker installed.

Alternatively, you can run pytest yourself. The MongoDB unit tests will be skipped if no server is available on your local machine:

pytest

Format the code 🍂

Execute the following command to apply pre-commit formatting:

make lint

Contributors and sponsors ☕️

All Contributors

Thanks goes to these wonderful people (emoji key):


Yasser Tahiri

💻 📖 🚧 🚇

Abderrahim SOUBAI-ELIDRISI

👀 📖

Ismail Ghallou

💻 🛡️

talentuno LLC

💵

Cactus LLC

💵

MojixCoder

💻 🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

AuthX - A FastAPI package for Auth made by a human not an AI | Product Hunt

License 📝

This project is licensed under the terms of the MIT License.

Comments
  • There is ambiguous loop in resolve_user for social auth

    There is ambiguous loop in resolve_user for social auth

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to AuthX but to Pydantic.
    • [X] I already checked if it is not related to AuthX but to FastAPI.

    Example Code

    while True: 
         resolved_username = f"{username}{postfix}" 
         existing_username = await self._repo.get_by_username(resolved_username) 
         if not existing_username: 
             break
    

    Description

    Could you please some one check this below code base where loop is indicating something ambiguous .

    https://github.com/yezz123/authx/blob/eefba52c32222b88171e4b300d025937496d7e1f/authx/services/social.py#L127-L131

    Operating System

    macOS

    Operating System Details

    No response

    FastAPI Version

    0.85.0

    Python Version

    3.9

    Additional Context

    No response

    bug python 
    opened by iftenet 6
  • chore: Create a Basic Example to serve utility of AuthX

    chore: Create a Basic Example to serve utility of AuthX

    I tried here to create a dockerized authentication API helping Developers to understand how AuthX works correctly.

    • Mostly you could use a Pre-configured Dockerfile to run the project:
    $ docker-compose up
    
    enhancement Extra Large 
    opened by yezz123 5
  • 👷 Support Profiling for checking service performance

    👷 Support Profiling for checking service performance

    Idea

    Profiling is a technique to figure out how time is spent in a program. With these statistics, we can find the “hot spot” of a program and think about ways of improvement. Sometimes, a hot spot in an unexpected location may also hint at a bug in the program.

    Pyinstrument is a Python profiler. A profiler is a tool to help you optimize your code - make it faster.

    Profile a web request in FastAPI

    To profile call stacks in FastAPI, you can write a middleware extension for pyinstrument.

    Create an async function and decorate it with app.middleware('http') where the app is the name of your FastAPI application instance.

    Make sure you configure a setting to only make this available when required.

    from pyinstrument import Profiler
    
    
    PROFILING = True  # Set this from a settings model
    
    if PROFILING:
        @app.middleware("http")
        async def profile_request(request: Request, call_next):
            profiling = request.query_params.get("profile", False)
            if profiling:
                profiler = Profiler(interval=settings.profiling_interval, async_mode="enabled")
                profiler.start()
                await call_next(request)
                profiler.stop()
                return HTMLResponse(profiler.output_html())
            else:
                return await call_next(request)
    

    To invoke, make any request to your application with the GET parameter profile=1 and it will print the HTML result from pyinstrument.

    AuthX's Support

    With AuthX the abstract of profiling is easy, it's just about calling the ProfilerMiddleware 's class and calling it in add_middleware(ProfilerMiddleware) func that FastAPI provides.

    References:

    TODO

    • [x] Add Function of Exporting results locally.
    • [x] Add Tests for testing the ProfilerMiddleware's class.
    • [x] Add Documentation for this Part of Middleware's support
    • [x] Add a Little example of how we can use it to Profile our FastAPI application
    documentation enhancement 
    opened by yezz123 4
  • chore: Add Open Authorization Configuration

    chore: Add Open Authorization Configuration

    A Startlette middleware for authentication through oauth2's via a secret key, which is often used to add authentication and authorization to a web application that interacts with an API on behalf of the user.

    This middleware is intended to be used when the application relies on an external tenant (e.g. Microsoft AD) for authentication.

    enhancement Large 
    opened by yezz123 4
  • chore(dev): Add Sessions Requirements

    chore(dev): Add Sessions Requirements

    A Redis-based session backend for the Fastapi applications

    from typing import Any
    
    from fastapi import Depends, FastAPI, Request, Response
    
    from authx.core import deleteSession, getSession, getSessionId, getSessionStorage, setSession, SessionStorage
    
    app = FastAPI(title=__name__)
    
    
    @app.post("/setSession")
    async def _setSession(
        request: Request, response: Response, sessionStorage: SessionStorage = Depends(getSessionStorage)
    ):
        sessionData = await request.json()
        setSession(response, sessionData, sessionStorage)
    
    
    @app.get("/getSession")
    async def _setSession(session: Any = Depends(getSession)):
        return session
    
    
    @app.post("/deleteSession")
    async def _deleteSession(
        sessionId: str = Depends(getSessionId), sessionStorage: SessionStorage = Depends(getSessionStorage)
    ):
        deleteSession(sessionId, sessionStorage)
        return None
    
    

    Config

    Deafult Config

    • url of Redis: redis://localhost:6379/0
    • name of sessionId: ssid
    • generator function of sessionId: lambda :uuid.uuid4().hex
    • expire time of session in redis: 6 hours

    Custom Config

    from authx.cache import basicConfig
    
    basicConfig(
        redisURL="redis://localhost:6379/1",
        sessionIdName="sessionId",
        sessionIdGenerator=lambda: str(random.randint(1000, 9999)),
        expireTime=timedelta(days=1),
        )
    
    enhancement Large 
    opened by yezz123 3
  • chore(Dev): Configure Mypy and Setup Static Typing Checker

    chore(Dev): Configure Mypy and Setup Static Typing Checker

    Mypy is a static type checker for Python 3 and Python 2.7. If you sprinkle your code with type annotations, mypy can type check your code and find common bugs. As mypy is a static analyzer or a lint-like tool, the type annotations are just hints for mypy and don’t interfere when running your program. You run your program with a standard Python interpreter, and the annotations are treated effectively as comments.

    enhancement Extra Large 
    opened by yezz123 3
  • empty Scheduled daily dependency update on Tuesday

    empty Scheduled daily dependency update on Tuesday

    Update aioredis from 2.0.0 to 2.0.1.

    Changelog

    2.0.1

    Features
    
    - Added Python 3.10 to CI & Updated the Docs
    (see 1160)
    - Enable mypy in CI (see 1101)
    - Synchronized reading the responses from a connection
    (see 1106)
    
    Fixes
    
    - Remove __del__ from Redis (Fixes 1115)
    (see 1227)
    - fix socket.error raises (see 1129)
    - Fix buffer is closed error when using PythonParser class
    (see 1213)
    
    Links
    • PyPI: https://pypi.org/project/aioredis
    • Changelog: https://pyup.io/changelogs/aioredis/
    • Repo: https://github.com/aio-libs/aioredis-py
    No Changes update 
    opened by pyup-bot 3
  • Remove unnecessary calls to `enumerate` when the index variable is not used.

    Remove unnecessary calls to `enumerate` when the index variable is not used.

    Enumerating iterables with enumerate is a good practice for having access to both the values and their respective indices. However, when the indices are not necessary, it is cleaner to simply iterate over the original iterable and remove the call to enumerate.

    enhancement Extra Small 
    opened by yezz123 3
  • empty Scheduled daily dependency update on Saturday

    empty Scheduled daily dependency update on Saturday

    Update mkdocs-material from 8.0.3 to 8.0.4.

    Changelog

    8.0.4

    * Improved support for deeply nested code annotations
    * Improved code annotation and copy-to-clipboard interop
    * Improved styling for code annotations inside admonitions
    * Fixed 3294: Lists after code blocks without code annotations disappearing
    * Fixed 3274: Invalid anchor positioning when using instant loading
    * Fixed several positioning issues for code annotations
    * Fixed JavaScript source map roots
    
    mkdocs-material-8.0.3+insiders-4.2.0 (2021-12-02)
    
    * Added support for dismissable announcement bar
    * Added support for named placeholders in feedback widget
    
    Links
    • PyPI: https://pypi.org/project/mkdocs-material
    • Changelog: https://pyup.io/changelogs/mkdocs-material/
    • Repo: https://squidfunk.github.io/mkdocs-material/
    Medium 
    opened by pyup-bot 3
  • chore: add FastAPI to Classifiers

    chore: add FastAPI to Classifiers

    After @tiangolo opened the PR https://github.com/pypa/trove-classifiers/pull/80 relate to adding FastAPI as a new trove classifier, that's gonna help to add it in our setup file. thanks to @mristin for requesting to add it https://github.com/pypa/trove-classifiers/issues/63 as a Framework. 🚀

    the release commit: https://github.com/pypa/trove-classifiers/commit/4e2248b1fce527e3943358037a1d5db8e8186fd5

    Extra Small 
    opened by yezz123 3
  • ⬆ Update fastapi requirement from <0.87.0,>=0.65.2 to >=0.65.2,<0.89.0

    ⬆ Update fastapi requirement from <0.87.0,>=0.65.2 to >=0.65.2,<0.89.0

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.88.0

    Upgrades

    • ⬆ Bump Starlette to version 0.22.0 to fix bad encoding for query parameters in new TestClient. PR #5659 by @​azogue.

    Docs

    Translations

    • 🌐 Add Portuguese translation for docs/pt/docs/deployment/docker.md. PR #5663 by @​ayr-ton.

    Internal

    Commits
    • 612b8ff 🔖 Release version 0.88.0
    • 46bb5d2 📝 Update release notes
    • c458ca6 📝 Update release notes
    • 46974c5 ⬆ Bump Starlette to version 0.22.0 to fix bad encoding for query parameters...
    • 89ec1f2 📝 Update release notes
    • 128c925 📝 Update release notes
    • 8842036 👷 Tweak build-docs to improve CI performance (#5699)
    • 9b4e85f ⬆ [pre-commit.ci] pre-commit autoupdate (#5566)
    • 991db7b 📝 Update release notes
    • ebd917a 🌐 Add Portuguese translation for docs/pt/docs/deployment/docker.md (#5663)
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 3
  • raise NotImplementedError in BaseDBBackend

    raise NotImplementedError in BaseDBBackend

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to AuthX but to Pydantic.
    • [X] I already checked if it is not related to AuthX but to FastAPI.

    Example Code

    Following this example: https://github.com/yezz123/authx/blob/main/example/app/main.py
    

    Description

    I cloned the repository, and I'm trying out AuthX as it looks to be what I want. I've run into the following issues:

    1. A sqlite DB isn't generated. I can see in the BaseDBBackend class, there are a bunch of raise NotImplementedError, does this mean the BaseDBBackend isn't finished yet?
    2. When starting the app and navigating to /docs, I can see a bunch of endpoints, but the register endpoint, for example, doesn't let me put it any parameters.

    When will the sqlite DB backend be finished?

    Operating System

    Linux

    Operating System Details

    No response

    FastAPI Version

    0.77.1

    Python Version

    3.10.4

    Additional Context

    image

    enhancement question 
    opened by nickshanks347 2
  • Failed to import RedisCacheBackend and JWTBackend class from authx. Version 0.4.0

    Failed to import RedisCacheBackend and JWTBackend class from authx. Version 0.4.0

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to AuthX but to Pydantic.
    • [X] I already checked if it is not related to AuthX but to FastAPI.

    Example Code

    from authx import RedisCacheBackend, JWTBackend, RedisBackend
    from fastapi import Depends, FastAPI
    from fastapi.security import HTTPBearer
    from starlette.config import Config
    
    app = FastAPI(
        title="AuthX",
        description="AuthX authentication system for fastapi.",
        version="0.1.0",
    )
    
    config = Config(".env")
    
    SecurityConfig = JWTBackend(
        cache_backend=RedisBackend,
        private_key=config("PRIVATE_KEY", default="private_key"),
        public_key=config("PUBLIC_KEY", default="public_key"),
        access_expiration=3600,
        refresh_expiration=3600
    )
    
    oauth_token_scheme = HTTPBearer()
    
    
    # app.include_router(starlette_app.router) # pygeoapi
    
    # Set Anonymous User
    @app.get("/anonym")
    def anonym_test():
        pass
    
    
    # Set Authenticated User
    @app.get("/user")
    async def user_test(token=Depends(oauth_token_scheme)):
        is_verified = await SecurityConfig.decode_token(token)
        print(is_verified)
        pass
    

    Description

    as specified in the documentation for jwt implementation https://authx.yezz.codes/configuration/security/jwt/ , from authx import RedisCacheBackend, JWTBackend should not return an error. as shown below Screenshot from 2022-04-02 15-06-33

    • i want to use JWTBackend to verify token using FastAPI dependency injection. a token should be passed to the swaggerUI docs from fastapi. and should be accessible via the oauth_token_scheme.
    • is_verified should return a boolean showing the verification state of the token, returns None instead of a boolean

    Suspected problem RedisCacheBackend is not an exported class from the module - not part of the module, but that is what was shown according to the documentation. using RedisBackend(this is exported from the module) instead, returns TypeError `Expected Type 'RedisBackend', got Type[RedisBackend] instead. in the JWTBackend class

    Operating System

    Linux

    Operating System Details

    No response

    FastAPI Version

    0.75.1

    Python Version

    python 3.8.10

    Additional Context

    No response

    bug question 
    opened by r-scheele 3
  • http://host/docs parameters are missing

    http://host/docs parameters are missing

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to AuthX but to Pydantic.
    • [X] I already checked if it is not related to AuthX but to FastAPI.

    Example Code

    from fastapi import APIRouter, Depends, FastAPI
    from starlette.config import Config
    
    from authx import Authentication, User
    
    app = FastAPI(
        title="AuthX",
        description="AuthX is a simple authentication system for fastapi.",
        version="0.1.0",
    )
    
    config = Config(".env")
    
    auth = Authentication(
        debug=config("DEBUG", default=False, cast=bool),
        base_url=config("BASE_URL", default="http://localhost:8000"),
        site=config("SITE", default="authx"),
        database_backend=config("DATABASE_BACKEND", default="sqlite"),
        callbacks=[],
        access_cookie_name=config("ACCESS_COOKIE_NAME", default="access_token"),
        refresh_cookie_name=config("REFRESH_COOKIE_NAME", default="refresh_token"),
        private_key=config("PRIVATE_KEY", default="private_key"),
        public_key=config("PUBLIC_KEY", default="public_key"),
        access_expiration=config("ACCESS_EXPIRATION", default=3600),
        refresh_expiration=config("REFRESH_EXPIRATION", default=86400),
        smtp_username=config("SMTP_USERNAME", default="username"),
        smtp_password=config("SMTP_PASSWORD", default="password"),
        smtp_host=config("SMTP_HOST", default="smtp.gmail.com"),
        smtp_tls=config("SMTP_TLS", default=True),
        display_name=config("DISPLAY_NAME", default="AuthX"),
        recaptcha_secret=config("RECAPTCHA_SECRET", default="secret"),
        social_providers=[],
        social_creds=None,
    )
    
    router = APIRouter()
    
    
    app.include_router(auth.auth_router, prefix="/api/auth", tags=["auth"])
    app.include_router(auth.password_router, prefix="/api/password", tags=["password"])
    app.include_router(auth.admin_router, prefix="/api/admin", tags=["admin"])
    app.include_router(auth.search_router, prefix="/api/search", tags=["search"])
    
    # Set Anonymous User
    @router.get("/anonym")
    def anonym_test(user: User = Depends(auth.get_user)):
        pass
    
    
    # Set Authenticated User
    @router.get("/user")
    def user_test(user: User = Depends(auth.get_authenticated_user)):
        pass
    
    
    # Set Admin User
    @router.get("/admin", dependencies=[Depends(auth.admin_required)])
    def admin_test():
        pass
    
    ---
    # authx/routers/auth.py
        ...
        router = APIRouter()
    
        @router.post("/register", name="auth:register")
        async def register(*, request: Request, response: Response):
            """
            register a new user
            Args:
                request: Request
                response: Response
    
            Returns:
                Response
            """
            data = await request.json()
            service = AuthService()
    
            tokens = await service.register(data)
            set_tokens_in_response(response, tokens)
            return None
            ...
    

    Description

    Running either the new example/cache or example/main (modified for dependencies) one finds that the API docs are without parameter suggestions for most endpoints.

    Operating System

    Linux

    Operating System Details

    Using Docker within Arch distro.

    FastAPI Version

    0.68.1

    Python Version

    3.9, 3.8

    Additional Context

    The project looks promising in many ways, and I hope it gets there.

    bug documentation question 
    opened by WP-LKL 3
Releases(0.8.1)
  • 0.8.1(Oct 12, 2022)

    What's Changed

    • increment postfix to find the possible username to use by @iftenet in https://github.com/yezz123/authx/pull/266
    • docs: add iftenet as a contributor for bug by @allcontributors in https://github.com/yezz123/authx/pull/267

    New Contributors

    • @iftenet made their first contribution in https://github.com/yezz123/authx/pull/266

    Full Changelog: https://github.com/yezz123/authx/compare/0.8.0...0.8.1

    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Oct 6, 2022)

    🔖 Release 0.8.0

    Implementation in FastAPI applications

    That's Work by adding a Middleware to your FastAPI application, working on collecting Prometheus metrics for each request, and then to handle that we need a function get_metrics to work on handling exposing the Prometheus metrics into the /metrics endpoint.

    from fastapi import FastAPI
    from authx.middleware import MetricsMiddleware, get_metrics
    
    app = FastAPI()
    app.add_middleware(MetricsMiddleware)
    app.add_route("/metrics", get_metrics)
    

    What's Changed

    Full Changelog: https://github.com/yezz123/authx/compare/0.7.0...0.8.0

    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Sep 18, 2022)

    • 🔧 Update package metadata and move build internals from Flit to Hatch.

    What's Changed

    • Migrate to Hatchling by @yezz123 in https://github.com/yezz123/authx/pull/261

    Full Changelog: https://github.com/yezz123/authx/compare/0.6.1...0.7.0

    Source code(tar.gz)
    Source code(zip)
  • 0.6.1(Sep 10, 2022)

    What's Changed

    • 🛠 chore(refactor): Improve Errors by @yezz123 in https://github.com/yezz123/authx/pull/257
    • 🔊 Update Dependencies by @yezz123 in https://github.com/yezz123/authx/pull/259
    • :bug: [WIP] fix client issue by @yezz123 in https://github.com/yezz123/authx/pull/260

    Full Changelog: https://github.com/yezz123/authx/compare/0.6.0...0.6.1

    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Jul 23, 2022)

    Idea

    Profiling is a technique to figure out how time is spent in a program. With these statistics, we can find the “hot spot” of a program and think about ways of improvement. Sometimes, a hot spot in an unexpected location may also hint at a bug in the program.

    Pyinstrument is a Python profiler. A profiler is a tool to help you optimize your code - make it faster.

    Profile a web request in FastAPI

    To profile call stacks in FastAPI, you can write a middleware extension for pyinstrument.

    Create an async function and decorate it with app.middleware('http') where the app is the name of your FastAPI application instance.

    Make sure you configure a setting to only make this available when required.

    from pyinstrument import Profiler
    PROFILING = True  # Set this from a settings model
    if PROFILING:
        @app.middleware("http")
        async def profile_request(request: Request, call_next):
            profiling = request.query_params.get("profile", False)
            if profiling:
                profiler = Profiler(interval=settings.profiling_interval, async_mode="enabled")
                profiler.start()
                await call_next(request)
                profiler.stop()
                return HTMLResponse(profiler.output_html())
            else:
                return await call_next(request)
    

    To invoke, make any request to your application with the GET parameter profile=1 and it will print the HTML result from pyinstrument.

    AuthX's Support

    With AuthX the abstract of profiling is easy, it's just about calling the ProfilerMiddleware 's class and calling it in add_middleware(ProfilerMiddleware) func that FastAPI provides.

    Example

    import os
    import uvicorn
    from fastapi import FastAPI
    from fastapi.responses import JSONResponse
    from authx import ProfilerMiddleware
    app = FastAPI()
    app.add_middleware(ProfilerMiddleware)
    @app.get("/test")
    async def normal_request():
        return JSONResponse({"retMsg": "Hello World!"})
    if __name__ == '__main__':
        app_name = os.path.basename(__file__).replace(".py", "")
        uvicorn.run(app=f"{app_name}:app", host="0.0.0.0", port=8080, workers=1)
    

    References

    What's Changed

    • 👷 Support Profiling for checking service performance by @yezz123 in https://github.com/yezz123/authx/pull/240
    • 👷 chore(fix): Fix Failed tests for Oauth2 by @yezz123 in https://github.com/yezz123/authx/pull/241
    • 🔖 Clean codebase from unread Docstrings by @yezz123 in https://github.com/yezz123/authx/pull/242
    • 📝 Docs: Upgrade pre-commit and add new markdown's linter by @yezz123 in https://github.com/yezz123/authx/pull/243
    • 🔧 Upgrade all Github Actions by @yezz123 in https://github.com/yezz123/authx/pull/249
    • Chore(deps): Bump jsmrcaga/action-netlify-deploy from 1.1.0 to 1.8.0 by @dependabot in https://github.com/yezz123/authx/pull/250
    • Add license scan report and status by @fossabot in https://github.com/yezz123/authx/pull/253
    • 🔖 release 0.6.0 - Supporting Profiling by @yezz123 in https://github.com/yezz123/authx/pull/255

    New Contributors

    • @fossabot made their first contribution in https://github.com/yezz123/authx/pull/253

    Full Changelog: https://github.com/yezz123/authx/compare/0.5.1...0.6.0

    Source code(tar.gz)
    Source code(zip)
  • 0.5.1(Jun 19, 2022)

    0.5.1

    Fix Wrong username validation UserInRegister model #237, Thanks to @YogeshUpdhyay 🙏🏻

    What's Changed

    • Username Validation Fixed by @YogeshUpdhyay in https://github.com/yezz123/authx/pull/238

    New Contributors

    • @YogeshUpdhyay made their first contribution in https://github.com/yezz123/authx/pull/238

    Full Changelog: https://github.com/yezz123/authx/compare/0.5.0...0.5.1

    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Jun 16, 2022)

    0.5.0

    Supporting SocketIO that's allows bi-directional communication between client and server. Bi-directional communications are enabled when a client has Socket.IO in the browser, and a server has also integrated the Socket.IO package. While data can be sent in a number of forms, JSON is the simplest.

    Usage

    To add SocketIO support to FastAPI all you need to do is import AuthXSocket and pass it FastAPI object.

    from fastapi import FastAPI
    from authx import AuthXSocket
    
    app = FastAPI()
    socket = AuthXSocket(app=app)
    

    you can import AuthXSocket object that exposes most of the SocketIO functionality.

    @AuthXSocket.on('leave')
    async def handle_leave(sid, *args, **kwargs):
        await AuthXSocket.emit('lobby', 'User left')
    

    Working with distributed applications

    When working with distributed applications, it is often necessary to access the functionality of the Socket.IO from multiple processes. As a solution to the above problems, the Socket.IO server can be configured to connect to a message queue such as Redis or RabbitMQ, to communicate with other related Socket.IO servers or auxiliary workers.

    Refer this link for more details using-a-message-queue

    
    import socketio
    from fastapi import FastAPI
    from authx import AuthXSocket
    
    app = FastAPI()
    
    redis_manager = socketio.AsyncRedisManager('redis://')
    
    socket_manager = AuthXSocket(app=app, client_manager=redis_manager)
    

    What's Changed

    • chore(ref): Improve API and refactor users management code by @yezz123 in https://github.com/yezz123/authx/pull/222
    • chore: Fix Issue of Missing requirements by @yezz123 in https://github.com/yezz123/authx/pull/225
    • chore(deps): update dependencies by @yezz123 in https://github.com/yezz123/authx/pull/233
    • 🔧 change domain from .codes to .me by @yezz123 in https://github.com/yezz123/authx/pull/235
    • chore(feat): support SocketIO in authx ✨ by @yezz123 in https://github.com/yezz123/authx/pull/234

    Full Changelog: https://github.com/yezz123/authx/compare/0.4.0...0.5.0

    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Mar 20, 2022)

    HTTPCache

    Overview

    HTTP caching occurs when the browser stores local copies of web resources for faster retrieval the next time the resource is required. As your application serves resources it can attach cache headers to the response specifying the desired cache behavior.

    Overview

    When an item is fully cached, the browser may choose to not contact the server at all and simply use its cached copy:

    Overview

    HTTP cache headers

    There are two primary cache headers, Cache-Control and Expires.

    Cache-Control

    The Cache-Control header is the most important header to set as it effectively switches on caching in the browser. With this header in place, and set with a value that enables caching, the browser will cache the file for as long as specified. Without this header, the browser will re-request the file on each subsequent request.

    Expires

    When accompanying the Cache-Control header, Expires simply sets a date from which the cached resource should no longer be considered valid. From this date forward the browser will request a fresh copy of the resource.

    This Introduction to HTTP Caching is based on the HTTP Caching Guide.

    AuthX provides a simple HTTP caching model designed to work with FastAPI,

    Initialize the cache

    from authx import HTTPCache
    from pytz import timezone
    
    africa_Casablanca = timezone('Africa/Casablanca')
    HTTPCache.init(redis_url=REDIS_URL, namespace='test_namespace', tz=africa_Casablanca)
    
    • Read More in the New Documentation: https://authx.yezz.codes/configuration/cache/httpcache/

    What's Changed

    • chore(docs): Improve Documentation by @yezz123 in https://github.com/yezz123/authx/pull/209
    • chore(dev): refactor code & improve some exceptions ✨ by @yezz123 in https://github.com/yezz123/authx/pull/212
    • ref: Use the built-in function next instead of a for-loop. by @yezz123 in https://github.com/yezz123/authx/pull/213
    • chore(docs): add New Sponsors ✨❤️ by @yezz123 in https://github.com/yezz123/authx/pull/214
    • docs(mkdocs.yml): Change name from middlewares to middleware by @theoohoho in https://github.com/yezz123/authx/pull/215
    • chore(f/l): Integrate Pyupgrade to AuthX Environment by @yezz123 in https://github.com/yezz123/authx/pull/216
    • chore(feat): Integrate HTTP Caching Model for authx ✨ by @yezz123 in https://github.com/yezz123/authx/pull/217
    • docs: add theoohoho as a contributor for doc by @allcontributors in https://github.com/yezz123/authx/pull/218
    • chore(Example): Provide New Cache Example✨ by @yezz123 in https://github.com/yezz123/authx/pull/219

    New Contributors

    • @theoohoho made their first contribution in https://github.com/yezz123/authx/pull/215

    Full Changelog: https://github.com/yezz123/authx/compare/0.3.1...0.4.0

    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(Jan 15, 2022)

    Session

    This is a supported Redis Based Session Storage for your FastAPI Application, you can use it with any Session Backend.

    pip install authx[session]
    

    Note: The requirements in authx[redis] are not the same used in Sessions features.

    Features


    • [x] Dependency injection to protect routes
    • [x] Compatible with FastAPI's auto-generated docs
    • [x] Pydantic models for verifying session data
    • [x] Abstract session backend so you can build one that fits your needs
    • [x] Abstract frontends to choose how you extract the session ids (cookies, header, etc.)
    • [x] Create verifiers based on the session data.
    • [x] Compatible with any Redis Configuration.

    Redis Configuration

    Before setting up our Sessions Storage and our CRUD Backend, we need to configure our Redis Instance.

    BasicConfig is a function that helps us set up the Instance Information like Redis Link Connection or ID Name or Expiration Time.

    Default Config

    • [x] url of Redis: redis://localhost:6379/0
    • [x] name of sessionId: ssid
    • [x] generator function of sessionId: lambda :uuid.uuid4().hex
    • [x] expire time of session in redis: 6 hours
    import random
    from datetime import timedelta
    from authx.cache import basicConfig
    
    basicConfig(
        redisURL="redis://localhost:6379/1",
        sessionIdName="sessionId",
        sessionIdGenerator=lambda: str(random.randint(1000, 9999)),
        expireTime=timedelta(days=1),
    )
    
    • Read the Changelog https://authx.yezz.codes/release/

    What's Changed

    • chore(dev): Add Sessions Requirements by @yezz123 in https://github.com/yezz123/authx/pull/207
    • chore(docs): Documented the Functionality of Session Storing by @yezz123 in https://github.com/yezz123/authx/pull/208

    Full Changelog: https://github.com/yezz123/authx/compare/0.3.0...0.3.1

    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Jan 8, 2022)

    What's Changed

    Release Notes

    Finally, we drop the full support from MongoDB Thanks to @stephane That's implemented some functionality under the name of BaseDBBackend and Create some Database Crud Functionality without a database.

    • Database Plugins:
      • MongoDB: Using MongoDB as a Database Backend is now supported as a plugin based on BaseDBBackend.

      • EncodeDB: Databases give you simple asyncio support for a range of databases.

        It allows you to make queries using the powerful SQLAlchemy Core expression language and provides support for PostgreSQL, MySQL, and SQLite.

        We can now provide some SQL queries to the database on the top of BaseDBBackend.

    MongoDB

    from authx import MongoDBBackend
    

    EncodeDB

    from authx import EncodeDBBackend
    

    Note: Don't forget to set up the database connection as a client that will be functioned under pre-built Methods.

    • Improve the package by Switching to flit to build the package.
      • Improve Workflow and integrate codecov.yml.
      • Use the issue of new Functionalities in Github.
      • Create New Directory called scripts to store the shell scripts to run tests or linting.
    • Improve Importing the package https://github.com/yezz123/authx/blob/main/authx/__init__.py.
      • Calling the function or the class directly from the __init__.py file.
    • Improve Documentation, and Describe different new Addons, that AuthX now provide such as new Database Backends or Plugins or the new middleware add-ons, Thanks to @AbderrahimSoubaiElidrissi
    • Update and upgrade Dependencies.
    • Inline and improve IDLE Support.

    Full Changelog: https://github.com/yezz123/authx/compare/0.2.0...0.3.0

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Jan 1, 2022)

    What's Changed

    Middleware - Oauth2

    The OAuth 2.0 authorization framework is a protocol that allows a user to grant a third-party website or application access to the user's protected resources, without necessarily revealing their long-term credentials or even their identity.

    Starlette middleware for authentication through oauth2's via a secret key, which is often used to add authentication and authorization to a web application that interacts with an API on behalf of the user.

    That's why AuthX provides a Configuration MiddlewareOauth2 to configure the OAuth2 middleware.

    from authx import MiddlewareOauth2
    
    class AuthenticateMiddleware(MiddlewareOauth2):
        PUBLIC_PATHS = {"/public"}
    

    Code Enhancement

    • Remove unnecessary calls to enumerate when the index variable is not used. by @yezz123 in https://github.com/yezz123/authx/pull/179
    • chore: Create a Basic Example to serve the utility of AuthX by @yezz123 in https://github.com/yezz123/authx/pull/178
    • Clean DocString & Define Functions by @yezz123 in https://github.com/yezz123/authx/pull/189

    Full Changelog: https://github.com/yezz123/authx/compare/0.1.4...0.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.1.4(Dec 12, 2021)

    What's Changed

    • Add FastAPI to Classifiers. #163
    • Drop the Using of Docker (CI). #165
    • Ignore some Functions and Classes from Tests. #168
    • Updates Development Dependencies. #155 ... #174 (Check full Changelog).
    • Update to FastAPI 0.70.1 #174

    Full Changelog: https://github.com/yezz123/authx/compare/0.1.3...0.1.4

    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Nov 14, 2021)

    • Fix the issue relate to PyJWT (Bumping version #151 )
    • Add sameSite to Cookies metadata ( #134)

    What's Changed

    • chore: add sameSite attribute to the http only cookie by @smakosh in https://github.com/yezz123/authx/pull/134
    • docs: add smakosh as a contributor for code, security by @allcontributors in https://github.com/yezz123/authx/pull/138
    • chore: update Requirements ✨ by @yezz123 in https://github.com/yezz123/authx/pull/139
    • CI: Add Code Security Analyse ✨ by @yezz123 in https://github.com/yezz123/authx/pull/140
    • empty Scheduled daily dependency update on Tuesday by @pyup-bot in https://github.com/yezz123/authx/pull/141
    • chore: Add JWT Algorithm Choices ✨ by @yezz123 in https://github.com/yezz123/authx/pull/143
    • Docs: Add financial Supporters ✨ by @yezz123 in https://github.com/yezz123/authx/pull/144
    • Bump PyJWT version from 1.7.1 to 2.3.0 by @MojixCoder in https://github.com/yezz123/authx/pull/151
    • docs: add MojixCoder as a contributor for code, bug by @allcontributors in https://github.com/yezz123/authx/pull/152
    • chore: Remove Todos assign 🖇 by @yezz123 in https://github.com/yezz123/authx/pull/153
    • Upgrade pre-commit requirements ✨ by @yezz123 in https://github.com/yezz123/authx/pull/154

    New Contributors

    • @smakosh made their first contribution in https://github.com/yezz123/authx/pull/134
    • @MojixCoder made their first contribution in https://github.com/yezz123/authx/pull/151

    Full Changelog: https://github.com/yezz123/authx/compare/0.1.2...0.1.3

    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Nov 8, 2021)

    After this discussion #124 with @stephane we need to change the package name that what pep's rules provide.

    Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.

    carbon

    What's Changed

    • Bump mkdocs-material from 7.2.6 to 7.3.5 by @dependabot in https://github.com/yezz123/authx/pull/101
    • Docs: Prepare Project for Being Public ✨ by @yezz123 in https://github.com/yezz123/authx/pull/102
    • Bump mkdocs-material from 7.3.5 to 7.3.6 by @dependabot in https://github.com/yezz123/authx/pull/103
    • Bump python from 3.9.2 to 3.10.0 by @dependabot in https://github.com/yezz123/authx/pull/104
    • docs: add yezz123 as a contributor for code, doc, maintenance, infra by @allcontributors in https://github.com/yezz123/authx/pull/105
    • docs: add AbderrahimSoubaiElidrissi as a contributor for review, doc by @allcontributors in https://github.com/yezz123/authx/pull/106
    • CI: Delete Docs Build ✨ by @yezz123 in https://github.com/yezz123/authx/pull/108
    • Docs: Delete a part of FAQ ✨ by @yezz123 in https://github.com/yezz123/authx/pull/109
    • chore: Fix workflows ✨ by @yezz123 in https://github.com/yezz123/authx/pull/112
    • chore: Rename Website name & Fix Build Issue 🚀 by @yezz123 in https://github.com/yezz123/authx/pull/113
    • Chore: Delete aiohttp by @yezz123 in https://github.com/yezz123/authx/pull/114
    • WIP: Add Code owner 🖇 by @yezz123 in https://github.com/yezz123/authx/pull/117
    • Chore: Fix Key Directory 🔑 by @yezz123 in https://github.com/yezz123/authx/pull/115
    • Configure .pyup ✨ by @yezz123 in https://github.com/yezz123/authx/pull/120
    • pep-0008: Fix Package and Module Names✨ by @yezz123 in https://github.com/yezz123/authx/pull/126
    • chore: Change project Name by @yezz123 in https://github.com/yezz123/authx/pull/128
    • chore: fix dockerfile commands by @yezz123 in https://github.com/yezz123/authx/pull/130
    • Chore: change Name from AuthX to authx ✨ by @yezz123 in https://github.com/yezz123/authx/pull/131
    • Bump version from 0.1.1 to 0.1.2 ✨ by @yezz123 in https://github.com/yezz123/authx/pull/132

    New Contributors

    • @allcontributors made their first contribution in https://github.com/yezz123/authx/pull/105

    Full Changelog: https://github.com/yezz123/authx/compare/0.1.1...0.1.2

    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Oct 26, 2021)

    • Kuddos to @AbderrahimSoubaiElidrissi for fixing multiple issues in docs ✨
    • Fix Database partial router.
    • Now we can call the cache or mongo only from a partial router.

    Example:

    main py

    What's Changed

    • Add a partial router to Database ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/97
    • Docs: Update documentation by @yezz123 in https://github.com/yezz123/AuthX/pull/98
    • Bump from 0.1.0 to 0.1.1 ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/99

    Full Changelog: https://github.com/yezz123/AuthX/compare/0.1.0...0.1.1

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Oct 24, 2021)

    What's Changed

    • docs: Add All Contributor by @yezz123 in https://github.com/yezz123/AuthX/pull/89
    • 📃 Docs: Add Codacy Review ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/90
    • CI: Fix Workflows ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/92
    • chore: Provide all requirements relate to Setup.py ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/93
    • ⬆️ Bump from 0.0.9 to 0.1.0 by @yezz123 in https://github.com/yezz123/AuthX/pull/94

    Full Changelog: https://github.com/yezz123/AuthX/compare/0.0.9...0.1.0

    Source code(tar.gz)
    Source code(zip)
  • 0.0.9(Oct 20, 2021)

    What's Changed

    • Bump mkdocs from 1.2.2 to 1.2.3 by @dependabot in https://github.com/yezz123/AuthX/pull/78
    • Bump pytest-asyncio from 0.14.0 to 0.16.0 by @dependabot in https://github.com/yezz123/AuthX/pull/77
    • 🐳 DockerFile Checker ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/80
    • chore: Provide DocString for Functions ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/84
    • Docs: Create a Release Notes ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/85
    • Chore: Add Local Testing & Code Coverage ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/86
    • Docs: Add Coverage Badge ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/87
    • ⬆️ Bump Version from 0.0.8 to 0.0.9 by @yezz123 in https://github.com/yezz123/AuthX/pull/88

    Full Changelog: https://github.com/yezz123/AuthX/compare/0.0.8...0.0.9

    Source code(tar.gz)
    Source code(zip)
  • 0.0.8(Oct 17, 2021)

    What's Changed

    • Fix Highlighting Issue ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/69
    • Docs: Add some Typo ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/70
    • Add Code of Conducts & License ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/71
    • Switch to MIT License ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/73
    • Test Documentation Build ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/74
    • ⬆️ Bump from 0.0.7 to 0.0.8 ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/75

    Full Changelog: https://github.com/yezz123/AuthX/compare/0.0.7...0.0.8

    Source code(tar.gz)
    Source code(zip)
  • 0.0.7(Oct 15, 2021)

    What's Changed

    • Implement DocStrings ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/60
    • Create a Global Documentation using Mkdocs by @yezz123 in https://github.com/yezz123/AuthX/pull/63
    • Fix Requirements by @yezz123 in https://github.com/yezz123/AuthX/pull/66
    • Fix Documentation by @yezz123 in https://github.com/yezz123/AuthX/pull/67
    • Version 0.0.7 ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/68

    Full Changelog: https://github.com/yezz123/AuthX/compare/0.0.6...0.0.7

    Source code(tar.gz)
    Source code(zip)
  • 0.0.6(Oct 11, 2021)

    What's Changed

    • Fix Environment Files by @yezz123 in https://github.com/yezz123/AuthX/pull/54
    • Provide More Classifiers ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/57
    • Setup Tests DocStrings ✨ by @yezz123 in https://github.com/yezz123/AuthX/pull/58

    Full Changelog: https://github.com/yezz123/AuthX/compare/0.0.5...0.0.6

    Source code(tar.gz)
    Source code(zip)
  • 0.0.5(Sep 29, 2021)

  • 0.0.4(Sep 29, 2021)

    During the work on this PR #44 :

    • I generate a docstring to improve the project & clear some parts of the code.
    • Add an Issue Template (Pre-public).
    • Create a simple Readme For the whole users.
    • Adding New Commands relate to the bumpversion package in the Makefile.
    Source code(tar.gz)
    Source code(zip)
  • 0.0.3(Sep 20, 2021)

  • 0.0.2(Sep 18, 2021)

    0.0.2 - Test Email Core ✨

    • Create a Testable Core for Email and work on Users and JWT.
    • work on a PR to test the Services and Provide more Routers tests
    Source code(tar.gz)
    Source code(zip)
  • 0.0.1(Sep 17, 2021)

    0.0.1 - First Release 🚀

    • Create Authentication Routes ex. Register, login, logout, and Reset.
    • Add The Social Authentication Routes, Connecting using Google and Facebook.
    • Give the Admin the Permission of Adding a User to the Blacklist or Ban a User from The API.
    • Done with Setup of Multiple Routes and Fix The Crud Issues.
    • Use the JWT package For Creating tokens and checking, also the Email Provider works with booths aiosmtplib and email-validator.
    • Provide the Common Models ex. Users Models and Social Models.
    • Create a Multiple Errors Support for Route and Models Validation or also if the Social Authentication CallBack got Errors.
    • Add A Recaptcha Bypass using Httpx Library and Create A String and Signature Generator using Passlib.
    • Using passlib to Verify the Password and Hash it under sha256.
    • Set up a workflow to Test The Project in a Docker environment.
    Source code(tar.gz)
    Source code(zip)
Owner
Yasser Tahiri
API / Backend Developer who speaks @python. Creator of @BnademOverflow. I love Open Source & Ancient Greece.
Yasser Tahiri
Customizable User Authorization & User Management: Register, Confirm, Login, Change username/password, Forgot password and more.

Flask-User v1.0 Attention: Flask-User v1.0 is a Production/Stable version. The previous version is Flask-User v0.6. User Authentication and Management

Ling Thio 916 Feb 15, 2021
FastAPI extension that provides JWT Auth support (secure, easy to use, and lightweight)

FastAPI JWT Auth Documentation: https://indominusbyte.github.io/fastapi-jwt-auth Source Code: https://github.com/IndominusByte/fastapi-jwt-auth Featur

Nyoman Pradipta Dewantara 468 Jan 1, 2023
Auth for use with FastAPI

FastAPI Auth Pluggable auth for use with FastAPI Supports OAuth2 Password Flow Uses JWT access and refresh tokens 100% mypy and test coverage Supports

David Montague 95 Jan 2, 2023
API-key based security utilities for FastAPI, focused on simplicity of use

FastAPI simple security API key based security package for FastAPI, focused on simplicity of use: Full functionality out of the box, no configuration

Tolki 154 Jan 3, 2023
Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.

Welcome to django-allauth! Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (soc

Raymond Penners 7.7k Jan 1, 2023
Flask user session management.

Flask-Login Flask-Login provides user session management for Flask. It handles the common tasks of logging in, logging out, and remembering your users

Max Countryman 3.2k Dec 28, 2022
Flask user session management.

Flask-Login Flask-Login provides user session management for Flask. It handles the common tasks of logging in, logging out, and remembering your users

Max Countryman 2.7k Feb 17, 2021
Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.

Welcome to django-allauth! Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (soc

Raymond Penners 7.7k Jan 3, 2023
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 Single- and multi-tenant support.

Easy and secure implementation of Azure AD for your FastAPI APIs ?? Single- and multi-tenant support.

Intility 220 Jan 5, 2023
A full Rest-API With Oauth2 and JWT for request & response a JSON file Using FastAPI and SQLAlchemy 🔑

Pexon-Rest-API A full Rest-API for request & response a JSON file, Building a Simple WorkFlow that help you to Request a JSON File Format and Handling

Yasser Tahiri 15 Jul 22, 2022
Implements authentication and authorization as FastAPI dependencies

FastAPI Security Implements authentication and authorization as dependencies in FastAPI. Features Authentication via JWT-based OAuth 2 access tokens a

Jacob Magnusson 111 Jan 7, 2023
Imia is an authentication library for Starlette and FastAPI (python 3.8+).

Imia Imia (belarussian for "a name") is an authentication library for Starlette and FastAPI (python 3.8+). Production status The library is considered

Alex Oleshkevich 91 Nov 24, 2022
Authentication with fastapi and jwt cd realistic

Authentication with fastapi and jwt cd realistic Dependencies bcrypt==3.1.7 data

Fredh Macau 1 Jan 4, 2022
FastAPI-Login tries to provide similar functionality as Flask-Login does.

FastAPI-Login FastAPI-Login tries to provide similar functionality as Flask-Login does. Installation $ pip install fastapi-login Usage To begin we hav

null 417 Jan 7, 2023
row level security for FastAPI framework

Row Level Permissions for FastAPI While trying out the excellent FastApi framework there was one peace missing for me: an easy, declarative way to def

Holger Frey 315 Dec 25, 2022
Simple implementation of authentication in projects using FastAPI

Fast Auth Facilita implementação de um sistema de autenticação básico e uso de uma sessão de banco de dados em projetos com tFastAPi. Instalação e con

null 3 Jan 8, 2022
Auth-Starters - Different APIs using Django & Flask & FastAPI to see Authentication Service how its work

Auth-Starters Different APIs using Django & Flask & FastAPI to see Authentication Service how its work, and how to use it. This Repository based on my

Yasser Tahiri 7 Apr 22, 2022
Use this to create (admin) personal access token in gitlab database. Mainly used for automation.

gitlab-personal-access-token Ensure PAT is present in gitlab database. This tool is mainly used when you need to automate gitlab installation and conf

CINAQ Internet Technologies 1 Jan 30, 2022
Toolkit for Pyramid, a Pylons Project, to add Authentication and Authorization using Velruse (OAuth) and/or a local database, CSRF, ReCaptcha, Sessions, Flash messages and I18N

Apex Authentication, Form Library, I18N/L10N, Flash Message Template (not associated with Pyramid, a Pylons project) Uses alchemy Authentication Authe

null 95 Nov 28, 2022