catch Exception coming from profiles methods, copy relayState into a local variable

This commit is contained in:
<bdauvergne@entrouvert.com> 1209043792 +0200 0001-01-01 00:00:00 +00:00
parent e7d604d7c9
commit 735bdd41c5
1 changed files with 19 additions and 8 deletions

View File

@ -3,9 +3,14 @@ require_once('lassospkit_helper.inc.php');
require_once('lassospkit_debug.inc.php');
require_once('lassospkit_utils.inc.php');
require_once('lassospkit_url_dispatch.inc.php');
require_once('lassospkit_generic_session.inc.php');
require_once('lassospkit_dummysession.inc.php');
require_once('lassospkit_autopersistentsession.inc.php');
class LassoSPKitEndpoint extends LassoSPKitUrlDispatch {
function LassoSPKitEndpoint($protocol) {
var $relayState = null;
function LassoSPKitEndpoint() {
$this->addDispatch('/assertionConsumer', 'assertionConsumer');
$this->addDispatch('/sloBrws','sloBrws');
$this->addDispatch('/sloSoap','sloSoap');
@ -45,12 +50,18 @@ class LassoSPKitEndpoint extends LassoSPKitUrlDispatch {
throw new Exception('Not implemented');
}
function assertionConsumer() {
$profile = $this->getProfileObject();
$http_method = $this->limitMethodBrws($this->identifyHttpMethod());
$query_string = $this->getQueryString($http_method);
$ok = $profile->ssoConsumer($http_method, $query_string);
$return_url = LassoSPKitUtilsSession::getRelayState('sso');
finish($return_url);
try {
$profile = $this->getProfileObject();
$http_method = $this->limitMethodBrws($this->identifyHttpMethod());
$query_string = $this->getQueryString($http_method);
$ok = $profile->ssoConsumer($http_method, $query_string);
$this->relayState = $profile->relayState;
return $ok;
} catch (LassoError $e) {
return $e->getCode();
} catch (Exception $e) {
return -1;
}
}
/** Profiles initiés par l'IdP */
function sloBrws() {
@ -74,7 +85,7 @@ class LassoSPKitEndpoint extends LassoSPKitUrlDispatch {
if (isset($_POST) && ( isset($_POST['SAMLResponse']) || isset($_POST['SAMLRequest']))) {
return LASSO_HTTP_METHOD_POST;
}
if (isset($_GET) && ( isset($_GET['SAMLResponse']) || isset($_GET['SAMLRequest']) ) {
if (isset($_GET) && ( isset($_GET['SAMLResponse']) || isset($_GET['SAMLRequest']) )) {
return LASSO_HTTP_METHOD_REDIRECT;
}
if (isset($_GET) && ( isset($_GET['SAMLart']))) {