1 import ./make-test-python.nix ({ pkgs, ... }: {
4 maintainers = with pkgs.lib.maintainers; [ delroth ];
11 listen = { addr = "127.0.0.1"; port = 8080; };
13 providers.token.tokens = {
20 rules = [ { field = "x-application"; equals = "MyApp"; } ];
32 machine.wait_for_unit("nginx-sso.service")
33 machine.wait_for_open_port(8080)
35 with subtest("No valid user -> 401"):
36 machine.fail("curl -sSf http://localhost:8080/auth")
38 with subtest("Valid user but no matching ACL -> 403"):
40 "curl -sSf -H 'Authorization: Token MyToken' http://localhost:8080/auth"
43 with subtest("Valid user and matching ACL -> 200"):
45 "curl -sSf -H 'Authorization: Token MyToken' -H 'X-Application: MyApp' http://localhost:8080/auth"