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 ⚑

Test codecov PyPI version Downloads Language framework Star Badge Pypi


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
  • 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 🌝

I use Pytest to run the tests, you can run this by using a shortcut command in the Makefile:

make test

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 Buy Me A Coffee

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
Login System Using Django

Login System Django

Nandini Chhajed 6 Dec 12, 2021
Django Rest Framework App wih JWT Authentication and other DRF stuff

Django Queries App with JWT authentication, Class Based Views, Serializers, Swagger UI, CI/CD and other cool DRF stuff API Documentaion /swagger - Swa

Rafael Salimov 4 Jan 29, 2022
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 01, 2023
A Python library for OAuth 1.0/a, 2.0, and Ofly.

Rauth A simple Python OAuth 1.0/a, OAuth 2.0, and Ofly consumer library built on top of Requests. Features Supports OAuth 1.0/a, 2.0 and Ofly Service

litl 1.6k Dec 08, 2022
JWT authentication for Pyramid

JWT authentication for Pyramid This package implements an authentication policy for Pyramid that using JSON Web Tokens. This standard (RFC 7519) is of

Wichert Akkerman 73 Dec 03, 2021
The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.

Authlib The ultimate Python library in building OAuth and OpenID Connect servers. JWS, JWK, JWA, JWT are included. Authlib is compatible with Python2.

Hsiaoming Yang 3.4k Jan 04, 2023
A JOSE implementation in Python

python-jose A JOSE implementation in Python Docs are available on ReadTheDocs. The JavaScript Object Signing and Encryption (JOSE) technologies - JSON

Michael Davis 1.2k Dec 28, 2022
Python library for generating a Mastercard API compliant OAuth signature.

oauth1-signer-python Table of Contents Overview Compatibility References Usage Prerequisites Adding the Library to Your Project Importing the Code Loa

23 Aug 01, 2022
Authentication for Django Rest Framework

Dj-Rest-Auth Drop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well with SPAs (e.g React, Vue, Ang

Michael 1.1k Jan 03, 2023
Todo app with authentication system.

todo list web app with authentication system. User can register, login, logout. User can login and create, delete, update task Home Page here you will

Anurag verma 3 Aug 18, 2022
Django Authetication with Twitch.

Django Twitch Auth Dependencies Install requests if not installed pip install requests Installation Install using pip pip install django_twitch_auth A

Leandro Lopes Bueno 1 Jan 02, 2022
Object Moderation Layer

django-oml Welcome to the documentation for django-oml! OML means Object Moderation Layer, the idea is to have a mixin model that allows you to modera

Angel VelΓ‘squez 12 Aug 22, 2019
JWT Key Confusion PoC (CVE-2015-9235) Written for the Hack the Box challenge - Under Construction

JWT Key Confusion PoC (CVE-2015-9235) Written for the Hack the Box challenge - Under Construction This script performs a Java Web Token Key Confusion

Alex Fronteddu 1 Jan 13, 2022
Simple yet powerful authorization / authentication client library for Python web applications.

Authomatic Authomatic is a framework agnostic library for Python web applications with a minimalistic but powerful interface which simplifies authenti

1k Dec 28, 2022
Doing the OAuth dance with style using Flask, requests, and oauthlib.

Flask-Dance Doing the OAuth dance with style using Flask, requests, and oauthlib. Currently, only OAuth consumers are supported, but this project coul

David Baumgold 915 Dec 28, 2022
Phishing Abusing Microsoft 365 OAuth Authorization Flow

Microsoft365_devicePhish Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack This is a simple proof-of-concept script that allows an at

bigb0ss 11 Dec 11, 2022
JSON Web Token Authentication support for Django REST Framework

REST framework JWT Auth JSON Web Token Authentication support for Django REST Framework Overview This package provides JSON Web Token Authentication s

Styria Digital Development 178 Jan 02, 2023
This Python based program checks your CC Stripe Auth 1$ Based Checker

CC-Checker This Python based program checks your CC Stripe Auth 1$ Based Checker About Author Coded by xBlackx Reach Me On Telegram @xBlackx_Coder jOI

xBlackxCoder 11 Nov 20, 2022
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
Brute force a JWT token. Script uses multithreading.

JWT BF Brute force a JWT token. Script uses multithreading. Tested on Kali Linux v2021.4 (64-bit). Made for educational purposes. I hope it will help!

Ivan Ε incek 5 Dec 02, 2022