Sync shared snapshot from 8bbaf3c
This commit is contained in:
1 parent
346f6f839f
commit
55b224bc48
4 files changed
+36
-10
No files matched your search
@@ -95,6 +95,7 @@ auth_client = AuthClient("") # pending: no URL yet, still safe to use
|
||||
core_config = CoreConfigStore(CoreConfigInfo(auth_guard_url=""))
|
||||
core_config.on_update(lambda info: auth_client.set_base_url(info.auth_guard_url))
|
||||
|
||||
|
||||
# in your framework's route for PUT /api/core-services/internal:
|
||||
async def push_core_services(request):
|
||||
if request.headers.get("X-Internal-Auth") != SECRET:
|
||||
@@ -128,19 +129,27 @@ completed" claim flag, and optionally a "require login" toggle) and calls
|
||||
from shared_backend.authclient import AuthClient
|
||||
from shared_backend.authproxy import ProxyStore, build_auth_router
|
||||
|
||||
|
||||
class MyStore(ProxyStore):
|
||||
async def login_required(self) -> bool: return True
|
||||
async def set_login_required(self, required: bool) -> None: pass
|
||||
async def is_setup_claimed(self) -> bool: ... # your own table
|
||||
async def try_claim_setup(self) -> bool: ... # your own table
|
||||
async def unclaim_setup(self) -> None: ... # your own table
|
||||
async def login_required(self) -> bool:
|
||||
return True
|
||||
|
||||
async def set_login_required(self, required: bool) -> None:
|
||||
pass
|
||||
|
||||
async def is_setup_claimed(self) -> bool: ... # your own table
|
||||
async def try_claim_setup(self) -> bool: ... # your own table
|
||||
async def unclaim_setup(self) -> None: ... # your own table
|
||||
|
||||
|
||||
def get_client(request):
|
||||
return request.app.state.auth_client # AuthClient | None, or None in auth-disabled mode
|
||||
|
||||
|
||||
def get_store(request):
|
||||
return request.app.state.auth_store
|
||||
|
||||
|
||||
app.include_router(
|
||||
build_auth_router(get_client, get_store, legacy_cookie_name="myproject_session"),
|
||||
prefix="/api/auth",
|
||||
|
||||
Reference in new issue
Block a user