Skip to content

Commit

Permalink
Follow-up on f42fd7b.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Jan 18, 2023
1 parent f42fd7b commit 7162452
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/websockets/legacy/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def basic_auth_protocol_factory(
credentials: Optional[Union[Credentials, Iterable[Credentials]]] = None,
check_credentials: Optional[Callable[[str, str], Awaitable[bool]]] = None,
create_protocol: Optional[Callable[..., BasicAuthWebSocketServerProtocol]] = None,
) -> Callable[[Any], BasicAuthWebSocketServerProtocol]:
) -> Callable[..., BasicAuthWebSocketServerProtocol]:
"""
Protocol factory that enforces HTTP Basic Auth.
Expand Down Expand Up @@ -175,11 +175,7 @@ async def check_credentials(username: str, password: str) -> bool:
return hmac.compare_digest(expected_password, password)

if create_protocol is None:
# Not sure why mypy cannot figure this out.
create_protocol = cast(
Callable[[Any], BasicAuthWebSocketServerProtocol],
BasicAuthWebSocketServerProtocol,
)
create_protocol = BasicAuthWebSocketServerProtocol

return functools.partial(
create_protocol,
Expand Down

0 comments on commit 7162452

Please sign in to comment.