in fxa/_utils.py [0:0]
def _match_url_scope(provided, required):
if not required.startswith('https:'):
return False
# Pop the hash fragments
(prov_url, prov_hash) = (provided.rsplit('#', 1) + [None])[:2]
(req_url, req_hash) = (required.rsplit('#', 1) + [None])[:2]
# Provided URL must be a prefix of required.
if req_url != prov_url:
if not (req_url.startswith(prov_url + '/')):
return False
# If hash is provided, it must match that required.
if prov_hash:
if not req_hash or req_hash != prov_hash:
return False
# It matches!
return True