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

7 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 15:52 +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 

9LicenseKeysRead = Annotated[ 1a

10 AuthSubject[User | Organization], 

11 Depends( 

12 Authenticator( 

13 required_scopes={ 

14 Scope.web_read, 

15 Scope.web_write, 

16 Scope.license_keys_read, 

17 Scope.license_keys_write, 

18 }, 

19 allowed_subjects={User, Organization}, 

20 ) 

21 ), 

22] 

23 

24LicenseKeysWrite = Annotated[ 1a

25 AuthSubject[User | Organization], 

26 Depends( 

27 Authenticator( 

28 required_scopes={ 

29 Scope.web_write, 

30 Scope.license_keys_write, 

31 }, 

32 allowed_subjects={User, Organization}, 

33 ) 

34 ), 

35]