Skip to content

Commit d01fee1

Browse files
committed
Replace calls to SimpleSAML_Utilities::fatalError with throwing an exception.
Also remove those instances of the $session variable that became unused. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2479 44740490-163a-0410-bde0-09ae8108e29a
1 parent b96c357 commit d01fee1

28 files changed

Lines changed: 69 additions & 89 deletions

modules/adfs/lib/IdP/ADFS.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function receiveAuthnRequest(SimpleSAML_IdP $idp) {
2525
SimpleSAML_Logger::info('ADFS - IdP.prp: Incoming Authentication request: '.$issuer.' id '.$requestid);
2626

2727
} catch(Exception $exception) {
28-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'PROCESSAUTHNREQUEST', $exception);
28+
throw new SimpleSAML_Error_Error('PROCESSAUTHNREQUEST', $exception);
2929
}
3030

3131
$sessionLostURL = NULL; // TODO?

modules/discopower/www/disco.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22

33
require_once('../www/_include.php');
44

5-
$session = SimpleSAML_Session::getInstance();
6-
75
try {
86
$discoHandler = new sspmod_discopower_PowerIdPDisco(array('saml20-idp-remote', 'shib13-idp-remote'), 'poweridpdisco');
97
} catch (Exception $exception) {
108
/* An error here should be caused by invalid query parameters. */
11-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'DISCOPARAMS', $exception);
9+
throw new SimpleSAML_Error_Error('DISCOPARAMS', $exception);
1210
}
1311

1412
try {
1513
$discoHandler->handleRequest();
1614
} catch(Exception $exception) {
1715
/* An error here should be caused by metadata. */
18-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
16+
throw new SimpleSAML_Error_Error('METADATA', $exception);
1917
}
2018

2119
?>

modules/openid/www/initopenid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$session = SimpleSAML_Session::getInstance();
1313

1414
if (empty($_REQUEST['RelayState'])) {
15-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
15+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
1616
}
1717

1818
if (! $session->isValid('openid') ) {

www/auth/login-admin.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@
1717
* we should redirect the user to after a successful authentication.
1818
*/
1919
if (!array_key_exists('RelayState', $_REQUEST)) {
20-
SimpleSAML_Utilities::fatalError(
21-
$session->getTrackID(),
22-
'NORELAYSTATE'
23-
);
20+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
2421
}
2522

2623
$relaystate = $_REQUEST['RelayState'];
2724

2825
$correctpassword = $config->getString('auth.adminpassword', '123');
2926

3027
if (empty($correctpassword) or $correctpassword === '123') {
31-
SimpleSAML_Utilities::fatalError(
32-
$session->getTrackID(),
33-
'NOTSET'
34-
);
28+
throw new SimpleSAML_Error_Error('NOTSET');
3529
}
3630

3731

www/auth/login-cas-ldap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333

3434

3535
} catch (Exception $exception) {
36-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
36+
throw new SimpleSAML_Error_Error('METADATA', $exception);
3737
}
3838

3939
/*
4040
* Load the RelayState argument. The RelayState argument contains the address
4141
* we should redirect the user to after a successful authentication.
4242
*/
4343
if (!array_key_exists('RelayState', $_REQUEST)) {
44-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
44+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
4545
}
4646

4747

@@ -135,7 +135,7 @@ function casValidate($cas) {
135135
SimpleSAML_Utilities::redirect($relaystate);
136136

137137
} catch(Exception $exception) {
138-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CASERROR', $exception);
138+
throw new SimpleSAML_Error_Error('CASERROR', $exception);
139139
}
140140

141141

www/auth/login-ldapmulti.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* we should redirect the user to after a successful authentication.
2121
*/
2222
if (!array_key_exists('RelayState', $_REQUEST)) {
23-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
23+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
2424
}
2525

2626
if (isset($_POST['username'])) {

www/auth/login-radius.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* we should redirect the user to after a successful authentication.
1717
*/
1818
if (!array_key_exists('RelayState', $_REQUEST)) {
19-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
19+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
2020
}
2121

2222
if (isset($_POST['username'])) {

www/auth/login-tlsclient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* we should redirect the user to after a successful authentication.
2121
*/
2222
if (!array_key_exists('RelayState', $_REQUEST)) {
23-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
23+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
2424
}
2525

2626
$relaystate = $_REQUEST['RelayState'];
@@ -35,7 +35,7 @@
3535
throw new Exception('Apache header variable SSL_CLIENT_VERIFY was not available. Recheck your apache configuration.');
3636

3737
if (strcmp($_SERVER['SSL_CLIENT_VERIFY'], "SUCCESS") != 0) {
38-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOTVALIDCERT', $e);
38+
throw new SimpleSAML_Error_Error('NOTVALIDCERT', $e);
3939
}
4040

4141
$userid = $_SERVER['SSL_CLIENT_S_DN'];
@@ -73,7 +73,7 @@
7373

7474

7575
} catch (Exception $e) {
76-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CONFIG', $e);
76+
throw new SimpleSAML_Error_Error('CONFIG', $e);
7777

7878
}
7979

www/auth/login-wayf-ldap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
$ldapconfig = $casldapconfig[$idpentityid]['ldap'];
3232

3333
} catch (Exception $exception) {
34-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
34+
throw new SimpleSAML_Error_Error('METADATA', $exception);
3535
}
3636

3737
/*
3838
* Load the RelayState argument. The RelayState argument contains the address
3939
* we should redirect the user to after a successful authentication.
4040
*/
4141
if (!array_key_exists('RelayState', $_REQUEST)) {
42-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
42+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
4343
}
4444

4545
$relaystate = $_REQUEST['RelayState'];
@@ -62,7 +62,7 @@
6262
SimpleSAML_Utilities::redirect($relaystate);
6363
}
6464
} catch(Exception $e) {
65-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'LDAPERROR', $e);
65+
throw new SimpleSAML_Error_Error('LDAPERROR', $e);
6666
}
6767
}
6868

www/auth/login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* we should redirect the user to after a successful authentication.
2222
*/
2323
if (!array_key_exists('RelayState', $_REQUEST)) {
24-
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
24+
throw new SimpleSAML_Error_Error('NORELAYSTATE');
2525
}
2626

2727
$relaystate = $_REQUEST['RelayState'];

0 commit comments

Comments
 (0)