diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php index c185e10a9ae74bb56dda0fdd2e9406c60d2254b5..f5d36fb4c9e5139e362cd17355e1c1f62ca8444c 100644 --- a/lib/SimpleSAML/Auth/Simple.php +++ b/lib/SimpleSAML/Auth/Simple.php @@ -179,6 +179,40 @@ class SimpleSAML_Auth_Simple { } + /** + * Retrieve authentication data. + * + * @param string $name The name of the parameter, e.g. 'Attribute', '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) { + assert('is_string($name)'); + + if (!$this->isAuthenticated()) { + return NULL; + } + + $session = SimpleSAML_Session::getInstance(); + return $session->getAuthData($this->authSource, $name); + } + + + /** + * Retrieve all authentication data. + * + * @return array|NULL All persistent authentication data, or NULL if we aren't authenticated. + */ + public function getAuthDataArray() { + + if (!$this->isAuthenticated()) { + return NULL; + } + + $session = SimpleSAML_Session::getInstance(); + return $session->getAuthState($this->authSource); + } + + /** * Retrieve an URL that can be used to log the user in. *