Stores — Aquilia Documentation
Comprehensive guide and documentation for Stores in the Aquilia framework. View API reference, examples, and implementation patterns.
Security & Auth Stores & Persistence AquilAuth uses protocol-based stores for identities, credentials, tokens, and OAuth data. Memory implementations are provided for development; swap in Redis or database-backed stores for production. Store Architecture , , , , ].map((s, i) => ( ))} IdentityStore Protocol class IdentityStore(Protocol): async def create(self, identity: Identity) -> None: ... async def get(self, identity_id: str) -> Identity | None: ... async def get_by_attribute(self, key: str, value: Any) -> Identity | None: ... async def update(self, identity: Identity) -> None: ... async def delete(self, identity_id: str) -> None: ... # soft delete async def list_by_tenant(self, tenant_id: str) -> list[Identity]: ... MemoryIdentityStore from aquilia.auth.stores import MemoryIdentityStore from aquilia.auth.core import Identity, IdentityType, IdentityStatus store = MemoryIdentityStore() # Create — auto-indexes string/int/bool attributes identity = Identity( id="user_42", type=IdentityType.USER, attributes= , tenant_id="org_1", ) await store.create(identity) CredentialStore Protocol class CredentialStore(Protocol): # Password credentials async def create_password(self, credential: PasswordCredential) -> None: ... async def get_password(self, identity_id: str) -> PasswordCredential | None: ... async def update_password(self, credential: PasswordCredential) -> None: ... OAuth Stores from aquilia.auth.stores import ( MemoryOAuthClientStore, MemoryAuthorizationCodeStore, MemoryDeviceCodeStore, ) RedisTokenStore (Production) For production deployments, RedisTokenStore provides fast revocation checks and automatic TTL-based cleanup. from aquilia.auth.stores import RedisTokenStore store = RedisTokenStore( redis_client=aioredis_client, # aioredis async client key_prefix="aquilauth:", # Redis key namespace ) Surp Artifacts & Audit Auth configuration and audit events can be stored as signed SurpArtifact objects. from aquilia.auth.surp import ( KeyArtifact, PolicyArtifact, AuditEventArtifact, ArtifactSigner, AuditLogger, MemoryArtifactStore, ) )
Go to Homepage