From 2d89b7c3654e99b19c5f0b175f7eb33419965a6f Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Tue, 26 Oct 2010 08:44:08 +0000 Subject: [PATCH] SimpleSAML_Auth_Simple: Add ReturnCallback. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2607 44740490-163a-0410-bde0-09ae8108e29a --- docs/simplesamlphp-sp-api.txt | 4 ++++ lib/SimpleSAML/Auth/Simple.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/simplesamlphp-sp-api.txt b/docs/simplesamlphp-sp-api.txt index 90969e1a9..54cd65a89 100644 --- a/docs/simplesamlphp-sp-api.txt +++ b/docs/simplesamlphp-sp-api.txt @@ -98,6 +98,10 @@ The following global parameters are supported: : The URL the user should be returned to after authentication. The default is to return the user to the current page. +`ReturnCallback` (`array`) + +: The function we should call when the user finishes authentication. + The [`saml:SP`](./saml:sp) authentication source also defines some parameters. diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php index b45d07bed..d036a1aa4 100644 --- a/lib/SimpleSAML/Auth/Simple.php +++ b/lib/SimpleSAML/Auth/Simple.php @@ -83,6 +83,8 @@ class SimpleSAML_Auth_Simple { * - 'KeepPost': If the current request is a POST request, keep the POST * data until after the authentication. * - 'ReturnTo': The URL the user should be returned to after authentication. + * - 'ReturnCallback': The function we should call after the user has + * finished authentication. * * @param array $params Various options to the authentication request. */ @@ -96,6 +98,8 @@ class SimpleSAML_Auth_Simple { if (array_key_exists('ReturnTo', $params)) { $returnTo = (string)$params['ReturnTo']; + } else if (array_key_exists('ReturnCallback', $params)) { + $returnTo = (array)$params['ReturnCallback']; } else { $returnTo = SimpleSAML_Utilities::selfURL(); } @@ -111,7 +115,7 @@ class SimpleSAML_Auth_Simple { } - if (!isset($params[SimpleSAML_Auth_State::RESTART])) { + if (!isset($params[SimpleSAML_Auth_State::RESTART]) && is_string($returnTo)) { /* * An URL to restart the authentication, in case the user bookmarks * something, e.g. the discovery service page. -- GitLab