Skip to content
Snippets Groups Projects
Unverified Commit 8d4a2429 authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Remove deprecated call to SimpleSAML_Error_NoPassive

parent 3e1e7064
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* *
* @package SimpleSAMLphp * @package SimpleSAMLphp
*/ */
class sspmod_saml_Error extends SimpleSAML_Error_Exception { class sspmod_saml_Error extends SimpleSAML_Error_Exception
{
/** /**
* The top-level status code. * The top-level status code.
* *
...@@ -39,7 +39,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -39,7 +39,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
* @param string|NULL $statusMessage The status message. Can be NULL, in which case there is no status message. * @param string|NULL $statusMessage The status message. Can be NULL, in which case there is no status message.
* @param Exception|NULL $cause The cause of this exception. Can be NULL. * @param Exception|NULL $cause The cause of this exception. Can be NULL.
*/ */
public function __construct($status, $subStatus = NULL, $statusMessage = NULL, Exception $cause = NULL) { public function __construct($status, $subStatus = null, $statusMessage = null, Exception $cause = null)
{
assert(is_string($status)); assert(is_string($status));
assert($subStatus === null || is_string($subStatus)); assert($subStatus === null || is_string($subStatus));
assert($statusMessage === null || is_string($statusMessage)); assert($statusMessage === null || is_string($statusMessage));
...@@ -64,7 +65,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -64,7 +65,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
* *
* @return string The top-level status code. * @return string The top-level status code.
*/ */
public function getStatus() { public function getStatus()
{
return $this->status; return $this->status;
} }
...@@ -74,7 +76,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -74,7 +76,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
* *
* @return string|NULL The second-level status code or NULL if no second-level status code is present. * @return string|NULL The second-level status code or NULL if no second-level status code is present.
*/ */
public function getSubStatus() { public function getSubStatus()
{
return $this->subStatus; return $this->subStatus;
} }
...@@ -84,7 +87,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -84,7 +87,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
* *
* @return string|NULL The status message or NULL if no status message is present. * @return string|NULL The status message or NULL if no status message is present.
*/ */
public function getStatusMessage() { public function getStatusMessage()
{
return $this->statusMessage; return $this->statusMessage;
} }
...@@ -98,8 +102,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -98,8 +102,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
* @param Exception $exception The original exception. * @param Exception $exception The original exception.
* @return sspmod_saml_Error The new exception. * @return sspmod_saml_Error The new exception.
*/ */
public static function fromException(Exception $exception) { public static function fromException(Exception $exception)
{
if ($exception instanceof sspmod_saml_Error) { if ($exception instanceof sspmod_saml_Error) {
// Return the original exception unchanged // Return the original exception unchanged
return $exception; return $exception;
...@@ -123,7 +127,7 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -123,7 +127,7 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
} else { } else {
$e = new self( $e = new self(
\SAML2\Constants::STATUS_RESPONDER, \SAML2\Constants::STATUS_RESPONDER,
NULL, null,
get_class($exception) . ': ' . $exception->getMessage(), get_class($exception) . ': ' . $exception->getMessage(),
$exception $exception
); );
...@@ -144,20 +148,24 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -144,20 +148,24 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
* *
* @return SimpleSAML_Error_Exception An exception representing this error. * @return SimpleSAML_Error_Exception An exception representing this error.
*/ */
public function toException() { public function toException()
$e = NULL; {
$e = null;
switch ($this->status) { switch ($this->status) {
case \SAML2\Constants::STATUS_RESPONDER: case \SAML2\Constants::STATUS_RESPONDER:
switch ($this->subStatus) { switch ($this->subStatus) {
case \SAML2\Constants::STATUS_NO_PASSIVE: case \SAML2\Constants::STATUS_NO_PASSIVE:
$e = new SimpleSAML_Error_NoPassive($this->statusMessage, 0, $this); $e = new SimpleSAML\Module\saml\Error\NoPassive(
\SAML2\Constants::STATUS_RESPONDER,
$this->statusMessage
);
break; break;
} }
break; break;
} }
if ($e === NULL) { if ($e === null) {
return $this; return $this;
} }
...@@ -174,7 +182,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { ...@@ -174,7 +182,8 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception {
* @param string $status The status code. * @param string $status The status code.
* @return string A shorter version of the status code. * @return string A shorter version of the status code.
*/ */
private static function shortStatus($status) { private static function shortStatus($status)
{
assert(is_string($status)); assert(is_string($status));
$t = 'urn:oasis:names:tc:SAML:2.0:status:'; $t = 'urn:oasis:names:tc:SAML:2.0:status:';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment