summaryrefslogtreecommitdiffstats
path: root/inc/simplesamlphp/lib/SimpleSAML/Auth/Simple.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/simplesamlphp/lib/SimpleSAML/Auth/Simple.php')
-rw-r--r--inc/simplesamlphp/lib/SimpleSAML/Auth/Simple.php43
1 files changed, 19 insertions, 24 deletions
diff --git a/inc/simplesamlphp/lib/SimpleSAML/Auth/Simple.php b/inc/simplesamlphp/lib/SimpleSAML/Auth/Simple.php
index 0041ddd..26f702c 100644
--- a/inc/simplesamlphp/lib/SimpleSAML/Auth/Simple.php
+++ b/inc/simplesamlphp/lib/SimpleSAML/Auth/Simple.php
@@ -4,7 +4,6 @@
* Helper class for simple authentication applications.
*
* @package simpleSAMLphp
- * @version $Id$
*/
class SimpleSAML_Auth_Simple {
@@ -48,7 +47,7 @@ class SimpleSAML_Auth_Simple {
* @return bool TRUE if the user is authenticated, FALSE if not.
*/
public function isAuthenticated() {
- $session = SimpleSAML_Session::getInstance();
+ $session = SimpleSAML_Session::getSessionFromRequest();
return $session->isValid($this->authSource);
}
@@ -70,7 +69,7 @@ class SimpleSAML_Auth_Simple {
*/
public function requireAuth(array $params = array()) {
- $session = SimpleSAML_Session::getInstance();
+ $session = SimpleSAML_Session::getSessionFromRequest();
if ($session->isValid($this->authSource)) {
/* Already authenticated. */
@@ -89,7 +88,7 @@ class SimpleSAML_Auth_Simple {
* This function accepts an array $params, which controls some parts of
* the authentication. The accepted parameters depends on the authentication
* source being used. Some parameters are generic:
- * - 'ErrorURL': An URL that should receive errors from the authentication.
+ * - 'ErrorURL': A URL that should receive errors from the authentication.
* - '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.
@@ -127,7 +126,7 @@ class SimpleSAML_Auth_Simple {
if (!isset($params[SimpleSAML_Auth_State::RESTART]) && is_string($returnTo)) {
/*
- * An URL to restart the authentication, in case the user bookmarks
+ * A URL to restart the authentication, in case the user bookmarks
* something, e.g. the discovery service page.
*/
$restartURL = $this->getLoginURL($returnTo);
@@ -152,7 +151,7 @@ class SimpleSAML_Auth_Simple {
* - 'ReturnStateParam': The parameter we should return the state in when redirecting.
* - 'ReturnStateStage': The stage the state array should be saved with.
*
- * @param string|array|NULL $params Either the url the user should be redirected to after logging out,
+ * @param string|array|NULL $params Either the URL the user should be redirected to after logging out,
* or an array with parameters for the logout. If this parameter is
* NULL, we will return to the current page.
*/
@@ -176,7 +175,7 @@ class SimpleSAML_Auth_Simple {
assert('isset($params["ReturnStateParam"]) && isset($params["ReturnStateStage"])');
}
- $session = SimpleSAML_Session::getInstance();
+ $session = SimpleSAML_Session::getSessionFromRequest();
if ($session->isValid($this->authSource)) {
$state = $session->getAuthData($this->authSource, 'LogoutState');
if ($state !== NULL) {
@@ -219,7 +218,7 @@ class SimpleSAML_Auth_Simple {
$params[$state['ReturnStateParam']] = $stateID;
}
- SimpleSAML_Utilities::redirect($state['ReturnTo'], $params);
+ SimpleSAML_Utilities::redirectTrustedURL($state['ReturnTo'], $params);
}
}
@@ -241,7 +240,7 @@ class SimpleSAML_Auth_Simple {
}
/* Authenticated. */
- $session = SimpleSAML_Session::getInstance();
+ $session = SimpleSAML_Session::getSessionFromRequest();
return $session->getAuthData($this->authSource, 'Attributes');
}
@@ -249,7 +248,7 @@ class SimpleSAML_Auth_Simple {
/**
* Retrieve authentication data.
*
- * @param string $name The name of the parameter, e.g. 'Attribute', 'Expire' or 'saml:sp:IdP'.
+ * @param string $name The name of the parameter, e.g. 'Attributes', 'Expire' or 'saml:sp:IdP'.
* @return mixed|NULL The value of the parameter, or NULL if it isn't found or we are unauthenticated.
*/
public function getAuthData($name) {
@@ -259,7 +258,7 @@ class SimpleSAML_Auth_Simple {
return NULL;
}
- $session = SimpleSAML_Session::getInstance();
+ $session = SimpleSAML_Session::getSessionFromRequest();
return $session->getAuthData($this->authSource, $name);
}
@@ -275,19 +274,17 @@ class SimpleSAML_Auth_Simple {
return NULL;
}
- $session = SimpleSAML_Session::getInstance();
+ $session = SimpleSAML_Session::getSessionFromRequest();
return $session->getAuthState($this->authSource);
}
/**
- * Retrieve an URL that can be used to log the user in.
+ * Retrieve a URL that can be used to log the user in.
*
- * @param string|NULL $returnTo
- * The page the user should be returned to afterwards. If this parameter
- * is NULL, the user will be returned to the current page.
- * @return string
- * An URL which is suitable for use in link-elements.
+ * @param string|NULL $returnTo The page the user should be returned to afterwards.
+ * If this parameter is NULL, the user will be returned to the current page.
+ * @return string A URL which is suitable for use in link-elements.
*/
public function getLoginURL($returnTo = NULL) {
assert('is_null($returnTo) || is_string($returnTo)');
@@ -306,13 +303,11 @@ class SimpleSAML_Auth_Simple {
/**
- * Retrieve an URL that can be used to log the user out.
+ * Retrieve a URL that can be used to log the user out.
*
- * @param string|NULL $returnTo
- * The page the user should be returned to afterwards. If this parameter
- * is NULL, the user will be returned to the current page.
- * @return string
- * An URL which is suitable for use in link-elements.
+ * @param string|NULL $returnTo The page the user should be returned to afterwards.
+ * If this parameter is NULL, the user will be returned to the current page.
+ * @return string A URL which is suitable for use in link-elements.
*/
public function getLogoutURL($returnTo = NULL) {
assert('is_null($returnTo) || is_string($returnTo)');