Skip to content

Commit

Permalink
make user required again
Browse files Browse the repository at this point in the history
  • Loading branch information
torkashvandmt committed Jun 7, 2024
1 parent adee789 commit 3fe3bfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions oauth2_lib/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class Authorization(ABC):
"""

@abstractmethod
async def authorize(self, request: HTTPConnection, user: Optional[OIDCUserModel] = None) -> Optional[bool]:
async def authorize(self, request: HTTPConnection, user: OIDCUserModel) -> Optional[bool]:
pass


Expand All @@ -274,7 +274,7 @@ class GraphqlAuthorization(ABC):
"""

@abstractmethod
async def authorize(self, request: RequestPath, user: Optional[OIDCUserModel] = None) -> Optional[bool]:
async def authorize(self, request: RequestPath, user: OIDCUserModel) -> Optional[bool]:
pass


Expand Down Expand Up @@ -324,7 +324,7 @@ class OPAAuthorization(Authorization, OPAMixin):
Uses OAUTH2 settings and request information to authorize actions.
"""

async def authorize(self, request: HTTPConnection, user_info: Optional[OIDCUserModel] = None) -> Optional[bool]:
async def authorize(self, request: HTTPConnection, user_info: OIDCUserModel) -> Optional[bool]:
if not (oauth2lib_settings.OAUTH2_ACTIVE and oauth2lib_settings.OAUTH2_AUTHORIZATION_ACTIVE):
return None

Expand Down Expand Up @@ -380,7 +380,7 @@ def __init__(self, opa_url: str, auto_error: bool = False, opa_kwargs: Union[Map
# By default don't raise HTTP 403 because partial results are preferred
super().__init__(opa_url, auto_error, opa_kwargs)

async def authorize(self, request: RequestPath, user_info: Optional[OIDCUserModel] = None) -> Optional[bool]:
async def authorize(self, request: RequestPath, user_info: OIDCUserModel) -> Optional[bool]:
if not (oauth2lib_settings.OAUTH2_ACTIVE and oauth2lib_settings.OAUTH2_AUTHORIZATION_ACTIVE):
return None

Expand Down

0 comments on commit 3fe3bfa

Please sign in to comment.