Skip to content
Snippets Groups Projects
Commit 8cdc186c authored by Jaime Pérez's avatar Jaime Pérez
Browse files

Model some SAML errors as exceptions in the SAML module.

This makes it easier to identify error conditions and return errors to an SP. More known errors should also be added here.
parent 3b761903
No related branches found
No related tags found
No related merge requests found
<?php
/**
* A SAML error indicating that none of the requested Authentication Contexts can be used.
*
* @author Jaime Pérez Crespo, UNINETT AS <jaime.perez@uninett.no>
* @package SimpleSAMLphp
*/
namespace SimpleSAML\Module\saml\Error;
use SAML2\Constants;
class NoAuthnContext extends \sspmod_saml_Error
{
/**
* NoAuthnContext error constructor.
*
* @param string $responsible A string telling who is responsible for this error. Can be one of the following:
* - \SAML2\Constants::STATUS_RESPONDER: in case the error is caused by this SAML responder.
* - \SAML2\Constants::STATUS_REQUESTER: in case the error is caused by the SAML requester.
* @param string|null $message A short message explaining why this error happened.
* @param \Exception|null $cause An exception that caused this error.
*/
public function __construct($responsible, $message = null, \Exception $cause = null)
{
parent::__construct($responsible, Constants::STATUS_NO_AUTHN_CONTEXT, $message, $cause);
}
}
<?php
/**
* A SAML error indicating that none of the requested IdPs can be used.
*
* @author Jaime Pérez Crespo, UNINETT AS <jaime.perez@uninett.no>
* @package SimpleSAMLphp
*/
namespace SimpleSAML\Module\saml\Error;
use SAML2\Constants;
class NoAvailableIDP extends \sspmod_saml_Error
{
/**
* NoAvailableIDP error constructor.
*
* @param string $responsible A string telling who is responsible for this error. Can be one of the following:
* - \SAML2\Constants::STATUS_RESPONDER: in case the error is caused by this SAML responder.
* - \SAML2\Constants::STATUS_REQUESTER: in case the error is caused by the SAML requester.
* @param string|null $message A short message explaining why this error happened.
* @param \Exception|null $cause An exception that caused this error.
*/
public function __construct($responsible, $message = null, \Exception $cause = null)
{
parent::__construct($responsible, Constants::STATUS_NO_AVAILABLE_IDP, $message, $cause);
}
}
<?php
/**
* A SAML error indicating that passive authentication cannot be used.
*
* @author Jaime Pérez Crespo, UNINETT AS <jaime.perez@uninett.no>
* @package SimpleSAMLphp
*/
namespace SimpleSAML\Module\saml\Error;
use SAML2\Constants;
class NoPassive extends \sspmod_saml_Error
{
/**
* NoPassive error constructor.
*
* @param string $responsible A string telling who is responsible for this error. Can be one of the following:
* - \SAML2\Constants::STATUS_RESPONDER: in case the error is caused by this SAML responder.
* - \SAML2\Constants::STATUS_REQUESTER: in case the error is caused by the SAML requester.
* @param string|null $message A short message explaining why this error happened.
* @param \Exception|null $cause An exception that caused this error.
*/
public function __construct($responsible, $message = null, \Exception $cause = null)
{
parent::__construct($responsible, Constants::STATUS_NO_PASSIVE, $message, $cause);
}
}
<?php
/**
* A SAML error indicating that none of the IdPs requested are supported.
*
* @author Jaime Pérez Crespo, UNINETT AS <jaime.perez@uninett.no>
* @package SimpleSAMLphp
*/
namespace SimpleSAML\Module\saml\Error;
use SAML2\Constants;
class NoSupportedIDP extends \sspmod_saml_Error
{
/**
* NoSupportedIDP error constructor.
*
* @param string $responsible A string telling who is responsible for this error. Can be one of the following:
* - \SAML2\Constants::STATUS_RESPONDER: in case the error is caused by this SAML responder.
* - \SAML2\Constants::STATUS_REQUESTER: in case the error is caused by the SAML requester.
* @param string|null $message A short message explaining why this error happened.
* @param \Exception|null $cause An exception that caused this error.
*/
public function __construct($responsible, $message = null, \Exception $cause = null)
{
parent::__construct($responsible, Constants::STATUS_NO_SUPPORTED_IDP, $message, $cause);
}
}
<?php
/**
* A SAML error indicating that the maximum amount of proxies traversed has been reached.
*
* @author Jaime Pérez Crespo, UNINETT AS <jaime.perez@uninett.no>
* @package SimpleSAMLphp
*/
namespace SimpleSAML\Module\saml\Error;
use SAML2\Constants;
class ProxyCountExceeded extends \sspmod_saml_Error
{
/**
* ProxyCountExceeded error constructor.
*
* @param string $responsible A string telling who is responsible for this error. Can be one of the following:
* - \SAML2\Constants::STATUS_RESPONDER: in case the error is caused by this SAML responder.
* - \SAML2\Constants::STATUS_REQUESTER: in case the error is caused by the SAML requester.
* @param string|null $message A short message explaining why this error happened.
* @param \Exception|null $cause An exception that caused this error.
*/
public function __construct($responsible, $message = null, \Exception $cause = null)
{
parent::__construct($responsible, Constants::STATUS_PROXY_COUNT_EXCEEDED, $message, $cause);
}
}
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