-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.php
87 lines (83 loc) · 2.18 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
require_once(__DIR__ . "/../vendor/autoload.php");
if (file_exists(__DIR__ . "/config.php")) {
require_once(__DIR__ . "/config.php");
}
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$base = 'https://sp.example.com';
$settings = [
'sp_entityid' => $base,
'sp_key_file' => './sp.key',
'sp_cert_file' => './sp.crt',
'sp_assertionconsumerservice' => [
$base . '/acs'
],
'sp_singlelogoutservice' => [
[$base . '/slo', "POST"],
[$base . '/slo', "REDIRECT"]
],
'sp_org_name' => 'test',
'sp_org_display_name' => 'Test',
'sp_key_cert_values' => [
'countryName' => 'IT',
'stateOrProvinceName' => 'Milan',
'localityName' => 'Milan',
'commonName' => 'Name',
'emailAddress' => 'test@test.com',
],
'idp_metadata_folder' => './idp_metadata/',
'sp_attributeconsumingservice' => [
["name", "familyName", "fiscalNumber", "email"],
["name", "familyName", "fiscalNumber", "email", "spidCode"]
]
];
$sp = new Italia\Spid\Sp($settings);
$request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
switch ($request_uri[0]) {
// Home page
case '/':
require './views/home.php';
break;
// Login page
case '/smart-button':
require './views/smart-button.php';
break;
// Login page
case '/login':
require './views/login.php';
break;
// Login POST page
case '/login-post':
require './views/login_post.php';
break;
// Login Smart Button page
case '/smart-button':
require './views/smart_button.php';
break;
// Metadata page
case '/metadata':
require './views/metadata.php';
break;
// Acs page
case '/acs':
require './views/acs.php';
break;
// Logout page
case '/logout':
require './views/logout.php';
break;
// Logout POST page
case '/logout-post':
require './views/logout_post.php';
break;
// Slo page
case '/slo':
require './views/slo.php';
break;
// Everything else
default:
echo "404 not found";
break;
}