Skip to content

Commit a82148f

Browse files
committed
Update example code to utilize the exception that may be provided by samlresponse->is_valid()
1 parent ff32808 commit a82148f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

consume.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@
88

99
$samlresponse = new SamlResponse(saml_get_settings(), $_POST['SAMLResponse']);
1010

11-
if ($samlresponse->is_valid())
12-
echo "You are: ".$samlresponse->get_nameid();
13-
else
14-
echo "Invalid SAML response.";
11+
$valid = false;
12+
13+
try {
14+
if ($samlresponse->is_valid())
15+
echo "You are: ".$samlresponse->get_nameid();
16+
else
17+
echo "Invalid SAML response.";
18+
}
19+
catch e {
20+
echo "Invalid SAML response: " . e.getMessage();
21+
}
1522

1623
?>

0 commit comments

Comments
 (0)