Coverage for src/lexigram/auth/storage/oauth_identity_store/__init__.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-26 00:58 +0800

1"""OAuth identity storage for linking users to OAuth providers. 

2 

3This module provides storage abstractions for linking OAuth2 identities 

4to local user accounts. This enables "social login" where users can 

5authenticate using external identity providers. 

6 

7Example: 

8 Implementing a custom OAuth identity store:: 

9 

10 from lexigram.auth.storage.oauth_identity_store import OAuthIdentityStore 

11 

12 class MyOAuthStore(OAuthIdentityStore): 

13 async def create_oauth_identity(self, user_id, provider, provider_user_id): 

14 # Store the OAuth link 

15 return OAuthIdentity(...) 

16 

17 async def get_oauth_identity(self, provider, provider_user_id): 

18 # Lookup by provider and external ID 

19 pass 

20 

21 # ... implement other methods 

22""" 

23 

24from __future__ import annotations 

25 

26from lexigram.auth.storage.oauth_identity_store._mongodb import ( 

27 MongoDBOAuthIdentityStore, 

28) 

29from lexigram.auth.storage.oauth_identity_store._protocol import ( 

30 OAuthIdentity, 

31 OAuthIdentityStore, 

32) 

33from lexigram.auth.storage.oauth_identity_store._sqlalchemy import ( 

34 SQLAlchemyOAuthIdentityStore, 

35) 

36from lexigram.logging import get_logger 

37 

38logger = get_logger(__name__) 

39 

40__all__ = [ 

41 "MongoDBOAuthIdentityStore", 

42 "OAuthIdentity", 

43 "OAuthIdentityStore", 

44 "SQLAlchemyOAuthIdentityStore", 

45 "logger", 

46]