Buckets:

download
raw
734 Bytes
import uvicorn
from fastapi import Depends, FastAPI
from fastapi_keycloak import FastAPIKeycloakAuth, OIDCUser
app = FastAPI()
idp = FastAPIKeycloakAuth(
server_url="https://auth.some-domain.com/auth",
client_id="some-client",
client_secret="some-client-secret",
realm="some-realm-name",
callback_uri="http://localhost:8081/callback",
)
idp.add_swagger_config(app)
@app.get("/admin")
def admin(user: OIDCUser = Depends(idp.get_current_user(required_roles=["admin"]))):
return f"Hi premium user {user}"
@app.get("/user/roles")
def user_roles(user: OIDCUser = Depends(idp.get_current_user())):
return f"{user.roles}"
if __name__ == "__main__":
uvicorn.run("app:app", host="127.0.0.1", port=8081)

Xet Storage Details

Size:
734 Bytes
·
Xet hash:
9aeda410165bb36dafadd2bfab59a11b39aa0c8e8a244535ba55ad94935513f9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.