aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/index.php8
-rw-r--r--routes/integration/auth-request.php14
2 files changed, 22 insertions, 0 deletions
diff --git a/routes/index.php b/routes/index.php
new file mode 100644
index 0000000..a5e66a8
--- /dev/null
+++ b/routes/index.php
@@ -0,0 +1,8 @@
+<?php
+
+function GET() {
+ $resp = new App\XMLResponse;
+ $content = $resp->doc->addChild('content');
+ $content->addChild('p', 'Welcome to Pleasant SSO!');
+ $resp->send();
+}
diff --git a/routes/integration/auth-request.php b/routes/integration/auth-request.php
new file mode 100644
index 0000000..82d1f03
--- /dev/null
+++ b/routes/integration/auth-request.php
@@ -0,0 +1,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'
+ );
+}