Coverage for polar/customer_portal/auth.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 12:42 +0000

1from typing import Annotated 

2 

3from fastapi import Depends 

4 

5from polar.auth.dependencies import Authenticator 

6from polar.auth.models import Anonymous, AuthSubject, Customer 

7from polar.auth.scope import Scope 

8 

9_CustomerPortalRead = Authenticator( 

10 required_scopes={ 

11 Scope.customer_portal_read, 

12 Scope.customer_portal_write, 

13 }, 

14 allowed_subjects={Customer}, 

15) 

16CustomerPortalRead = Annotated[AuthSubject[Customer], Depends(_CustomerPortalRead)] 

17 

18_CustomerPortalWrite = Authenticator( 

19 required_scopes={Scope.customer_portal_write}, 

20 allowed_subjects={Customer}, 

21) 

22CustomerPortalWrite = Annotated[AuthSubject[Customer], Depends(_CustomerPortalWrite)] 

23 

24_CustomerPortalOAuthAccount = Authenticator( 

25 required_scopes={Scope.customer_portal_write}, 

26 allowed_subjects={Customer, Anonymous}, 

27) 

28CustomerPortalOAuthAccount = Annotated[ 

29 AuthSubject[Customer | Anonymous], Depends(_CustomerPortalOAuthAccount) 

30]