Skip to content

Commit

Permalink
Back to abstract class
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinon committed Jul 21, 2022
1 parent 254cdd4 commit 5737120
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/common/core/identity_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class User(BaseModel):
roles: List[str]


class IdentityProvider(Protocol):
def get_current_user(self, required_roles: list[str] | None = None) -> Callable[[Any], User]:
class IdentityProvider(abc.ABC):
@abc.abstractmethod
def get_current_user(self, required_roles: list[str] | None = None):
"""Function that checks the current user based on an access token in the HTTP-header. Optionally verifies
roles are possessed by the user
Expand All @@ -26,4 +27,4 @@ def get_current_user(self, required_roles: list[str] | None = None) -> Callable[
JWTClaimsError: If any claim is invalid
HTTPException: If any role required is not contained within the roles of the users
"""
...
raise NotImplementedError

0 comments on commit 5737120

Please sign in to comment.