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 11 months ago
fastapi_sso_client fix empty state 11 months ago
tests add client tests 11 months ago
.gitignore initial commit 11 months ago
Pipfile revert setup.py 11 months ago
Pipfile.lock revert setup.py 11 months ago
README.md fix README.md 11 months ago
setup.py revert setup.py 11 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())