You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Василий Тащилин 8e0857fb44 revert setup.py 6 months ago
fastapi_sso_client fix empty state 7 months ago
tests add client tests 7 months ago
.gitignore initial commit 7 months ago
Pipfile revert setup.py 6 months ago
Pipfile.lock revert setup.py 6 months ago
README.md fix README.md 7 months ago
setup.py revert setup.py 6 months ago

README.md

Fastapi-sso-client

Installation

$ pipenv install -e git+https://git.brandquad.ru/common/fastapi-sso-client

Example

from fastapi import FastAPI, Depends

from fastapi_sso_client.auth import setup_auth
from fastapi_sso_client.storage import DumbJWTStorage
from fastapi_sso_client.deps import SSOAuthHeader

app = FastAPI(
    title="PROJECT_NAME", openapi_url=f"/api/v1/openapi.json"
)
jwt_depends = Depends(SSOAuthHeader(name="JWT"))

@app.get("/test", dependencies=[jwt_depends])
def test():
    return {"status": "ok"}

@app.get("/token")
def token(token: str = jwt_depends):
    return {"token": token}

setup_auth(app, "SSO_HOST", "SSO_ACCESS_TOKEN", "SSO_ACCESS_KEY", "SSO_ISSUER", DumbJWTStorage())