summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/api/resources/authentication.py
blob: a06d179e58ebbbb0b4b97f71c475d4927d3a5cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def main(request, response):
    user = request.auth.username
    password = request.auth.password

    if user == "user" and password == "password":
        return "Authentication done"

    realm = "test"
    if "realm" in request.GET:
        realm = request.GET.first("realm")

    return ((401, "Unauthorized"),
            [("WWW-Authenticate", 'Basic realm="' + realm + '"')],
            "Please login with credentials 'user' and 'password'")