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

9 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 AuthSubject, Organization, User 1a

7from polar.auth.scope import Scope 1a

8 

9_WebhooksRead = Authenticator( 1a

10 required_scopes={ 

11 Scope.web_read, 

12 Scope.web_write, 

13 Scope.webhooks_read, 

14 Scope.webhooks_write, 

15 }, 

16 allowed_subjects={User, Organization}, 

17) 

18WebhooksRead = Annotated[AuthSubject[User | Organization], Depends(_WebhooksRead)] 1a

19 

20_WebhooksWrite = Authenticator( 1a

21 required_scopes={ 

22 Scope.web_write, 

23 Scope.webhooks_write, 

24 }, 

25 allowed_subjects={User, Organization}, 

26) 

27WebhooksWrite = Annotated[AuthSubject[User | Organization], Depends(_WebhooksWrite)] 1a