summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/credential-management/support/fedcm/token_check_same_site_strict.py
blob: 4e55bf27f610032b30eb3278ddd0f7db4716efef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import importlib
error_checker = importlib.import_module("credential-management.support.fedcm.request-params-check")

def main(request, response):
  request_error = error_checker.tokenCheck(request)
  if (request_error):
    return request_error
  if request.cookies.get(b"same_site_strict") == b"1":
    return (546, [], "Should not send SameSite=Strict cookies")
  if request.cookies.get(b"same_site_lax") == b"1":
    return (547, [], "Should not send SameSite=Lax cookies")

  response.headers.set(b"Content-Type", b"application/json")
  response.headers.set(b"Access-Control-Allow-Origin", request.headers.get(b"Origin"))
  response.headers.set(b"Access-Control-Allow-Credentials", "true")

  return "{\"token\": \"token\"}"