aboutsummaryrefslogtreecommitdiff
path: root/routes/integration/auth-request.php
blob: 82d1f03525120adeb3a9b28e07ee7d10596394b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

// nginx (and others?) auth_request style endpoint
// returns 200 for allowed requests
// otherwise, returns 401 and sends the login page url as a header

function GET(array $config) {
    // in the absence of any auth backends i will say No to all requests
    http_response_code(401);
    header(
        $config['integration']['header-prefix'] . '-Location: https://'
      . $config['site']['primary-domain'] . '/login'
    );
}