@@ -10,19 +10,23 @@ This is the preferred API for integrating SimpleSAMLphp with other applications.
Some SimpleSAMLphp calls replace the current active PHP session. If you previously started a session and wish to write to it, then you must cleanup the SimpleSAMLphp session before you can write to your session. If you do not need to modify your own session, then you can leave the cleanup call out; however, forgetting to call cleanup is a common source of hard to find bugs.
session_start();
// ...
$auth = new \SimpleSAML\Auth\Simple('default-sp');
$auth->isAuthenticated(); // Replaces our session with the SimpleSAMLphp one
// $_SESSION['key'] = 'value'; // This would save to the SimpleSAMLphp session which isn't what we want
SimpleSAML_Session::getSessionFromRequest()->cleanup(); // Reverts to our PHP session
// Save to our session
$_SESSION['key'] = 'value';
```php
session_start();
// ...
$auth=new\SimpleSAML\Auth\Simple('default-sp');
$auth->isAuthenticated();// Replaces our session with the SimpleSAMLphp one
// $_SESSION['key'] = 'value'; // This would save to the SimpleSAMLphp session which isn't what we want
SimpleSAML_Session::getSessionFromRequest()->cleanup();// Reverts to our PHP session
// Save to our session
$_SESSION['key']='value';
```
Constructor
-----------
new \SimpleSAML\Auth\Simple(string $authSource)
```php
new\SimpleSAML\Auth\Simple(string$authSource)
```
The constructor initializes a \SimpleSAML\Auth\Simple object.
...
...
@@ -33,29 +37,36 @@ This authentication source must exist in `config/authsources.php`.
### Example
$auth = new \SimpleSAML\Auth\Simple('default-sp');
```php
$auth=new\SimpleSAML\Auth\Simple('default-sp');
```
`isAuthenticated`
-----------------
bool isAuthenticated()
```php
boolisAuthenticated()
```
Check whether the user is authenticated with this authentication source.
`TRUE` is returned if the user is authenticated, `FALSE` if not.