Skip to content

Commit 1969806

Browse files
committed
Separate SAML-related functions from functions.php
Prevent loading SimpleSAMLphp in the CLI context because it fails to load.
1 parent 04af36e commit 1969806

5 files changed

Lines changed: 19 additions & 15 deletions

File tree

auth-proxy/resources/htdocs/php/logout-fed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
require_once __DIR__ . '/../../lib/functions.php';
2+
require_once __DIR__ . '/../../lib/functions-fed.php';
33

44
logout_fed();
55
header('Location: /test');

auth-proxy/resources/htdocs/php/logout.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require_once __DIR__ . '/../../lib/functions.php';
3+
require_once __DIR__ . '/../../lib/functions-fed.php';
44
@session_start();
55

66
// remove cookies

auth-proxy/resources/htdocs/php/sp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require_once __DIR__ . '/../../lib/const.php';
33
require_once __DIR__ . '/../../lib/hub-const.php';
4-
require_once __DIR__ . '/../../lib/functions.php';
4+
require_once __DIR__ . '/../../lib/functions-fed.php';
55
require_once __DIR__ . '/../../simplesamlphp/public/_include.php';
66

77
@session_start();
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
require_once __DIR__ . '/../simplesamlphp/public/_include.php';
3+
require_once __DIR__ . '/functions.php';
4+
5+
/**
6+
* Logout from the federation
7+
*/
8+
function logout_fed()
9+
{
10+
$as = new \SimpleSAML\Auth\Simple('default-sp');
11+
if ($as->isAuthenticated()) {
12+
$as->logout();
13+
}
14+
}
15+
16+
?>

auth-proxy/resources/lib/functions.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
<?php
22
require_once __DIR__ . '/hub-const.php';
33
require_once __DIR__ . '/const.php';
4-
require_once __DIR__ . '/../simplesamlphp/public/_include.php';
54

65
$SESSION_NAME = session_name();
76

87

9-
/**
10-
* Logout from the federation
11-
*/
12-
function logout_fed()
13-
{
14-
$as = new \SimpleSAML\Auth\Simple('default-sp');
15-
if ($as->isAuthenticated()) {
16-
$as->logout();
17-
}
18-
}
19-
208
/**
219
* Check the user autorization of this Coursen
2210
*

0 commit comments

Comments
 (0)