Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Readme
DEV MESSAGE: Fastbase is currently still in development and in its current state is unfit for production. Check back again for updates.
Role-based Access Contral (RBAC) via Firebase idtoken
authententication using FastAPI and SQLModel.
Documentation: https://enchance.github.io/fastbase/class/fastbase/
pip install fastbase
or
poetry add fastbase
Fastbase assumes a headless setup using a frontend such as React, Angular, etc.
idtoken
will be
generated if successful.Authorization
header (Bearer <idtoken>
) when hitting restricted APIs.idtoken
is verified.To follow
To follow
Your required User
model. Optional models include TaxonomyMod
and OptionMod
which should be extended if you want
to use them. Add any additional fields you need.
from fastbase.models import UserMod, TaxonomyMod, OptionMod
# Required
class User(UserMod, table=True):
__tablename__ = 'auth_user'
# Add any fields and methods you need
# Optional
class Taxonomy(TaxonomyMod, table=True):
__tablename__ = 'app_taxonomy'
# Add any fields and methods you need
# Optional
class Option(OptionMod, table=True):
__tablename__ = 'app_option'
# Add any fields and methods you need
Initialize Fastbase
from sqlalchemy.ext.asyncio import create_async_engine
from fastapi import FastAPI
from fastbase import Fastbase
from contextlib import asynccontextmanager
from .models import User
# .env file
DATABASE_URL = 'postgresql+asyncpg://user:password@localhost:5432/dbname'
# DB engine
engine = create_async_engine(DATABASE_URL, echo=True, pool_size=10)
@asynccontextmanager
async def lifespan(_: FastAPI):
"""Insert in lifespan events on start: https://fastapi.tiangolo.com/advanced/events/"""
fbase = Fastbase()
fbase.initialize(engine=engine, user_model=User)
print('RUNNING')
yield
print('STOPPED')
FAQs
Unknown package
We found that fastbase demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.