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

11 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 17:15 +0000

1from typing import Annotated 1a

2 

3from fastapi import Depends 1a

4 

5from polar.auth.dependencies import Authenticator 1a

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

7from polar.auth.scope import Scope 1a

8 

9_CustomerPortalRead = Authenticator( 1a

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)] 1a

17 

18_CustomerPortalWrite = Authenticator( 1a

19 required_scopes={Scope.customer_portal_write}, 

20 allowed_subjects={Customer}, 

21) 

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

23 

24_CustomerPortalOAuthAccount = Authenticator( 1a

25 required_scopes={Scope.customer_portal_write}, 

26 allowed_subjects={Customer, Anonymous}, 

27) 

28CustomerPortalOAuthAccount = Annotated[ 1a

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

30]