1818
1919logger = logging .getLogger (__name__ )
2020
21+ DOMAIN_NAME = "localhost"
2122
2223def is_token_still_valid (datestr : str ):
2324 """
@@ -210,9 +211,9 @@ async def authenticate_jwk(request: web.Request) -> str:
210211 """Authenticate a request using the X-SignedPubKey and X-SignedOperation headers."""
211212 signed_pubkey = get_signed_pubkey (request )
212213 signed_operation = get_signed_operation (request )
213- if signed_pubkey .content .domain != settings . DOMAIN_NAME :
214+ if signed_pubkey .content .domain != DOMAIN_NAME :
214215 logger .debug (
215- f"Invalid domain '{ signed_pubkey .content .domain } ' != '{ settings . DOMAIN_NAME } '"
216+ f"Invalid domain '{ signed_pubkey .content .domain } ' != '{ DOMAIN_NAME } '"
216217 )
217218 raise web .HTTPUnauthorized (reason = "Invalid domain" )
218219 if signed_operation .content .path != request .path :
@@ -232,9 +233,9 @@ async def authenticate_websocket_message(message) -> str:
232233 """Authenticate a websocket message since JS cannot configure headers on WebSockets."""
233234 signed_pubkey = SignedPubKeyHeader .parse_obj (message ["X-SignedPubKey" ])
234235 signed_operation = SignedOperation .parse_obj (message ["X-SignedOperation" ])
235- if signed_pubkey .content .node_url != settings . DOMAIN_NAME :
236+ if signed_pubkey .content .node_url != DOMAIN_NAME :
236237 logger .debug (
237- f"Invalid domain '{ signed_pubkey .content .node_url } ' != '{ settings . DOMAIN_NAME } '"
238+ f"Invalid domain '{ signed_pubkey .content .node_url } ' != '{ DOMAIN_NAME } '"
238239 )
239240 raise web .HTTPUnauthorized (reason = "Invalid domain" )
240241 return verify_signed_operation (signed_operation , signed_pubkey )
0 commit comments