36 assert(
'is_array($info)');
37 assert(
'is_array($config)');
39 assert(
'array_key_exists("AuthId", $info)');
40 $this->authId =
$info[
'AuthId'];
54 assert(
'is_string($type)');
60 $sources =
$config->getOptions();
61 foreach ($sources as
$id) {
64 self::validateSource(
$source, $id);
115 assert(
'isset($state["ReturnCallback"])');
120 foreach (
$data as $k => $v) {
137 assert(
'is_array($state)');
138 assert(
'array_key_exists("LoginCompletedHandler", $state)');
142 $func =
$state[
'LoginCompletedHandler'];
143 assert(
'is_callable($func)');
145 call_user_func($func,
$state);
165 assert(
'is_string($return) || is_array($return)');
166 assert(
'is_string($errorURL) || is_null($errorURL)');
169 'SimpleSAML_Auth_Default.id' => $this->authId,
170 'SimpleSAML_Auth_Source.id' => $this->authId,
171 'SimpleSAML_Auth_Default.Return' => $return,
172 'SimpleSAML_Auth_Source.Return' => $return,
173 'SimpleSAML_Auth_Default.ErrorURL' => $errorURL,
174 'SimpleSAML_Auth_Source.ErrorURL' => $errorURL,
175 'LoginCompletedHandler' =>
array(get_class(),
'loginCompleted'),
176 'LogoutCallback' =>
array(get_class(),
'logoutCallback'),
177 'LogoutCallbackState' =>
array(
178 'SimpleSAML_Auth_Default.logoutSource' => $this->authId,
179 'SimpleSAML_Auth_Source.logoutSource' => $this->authId,
183 if (is_string($return)) {
184 $state[
'SimpleSAML_Auth_Default.ReturnURL'] = $return;
185 $state[
'SimpleSAML_Auth_Source.ReturnURL'] = $return;
188 if ($errorURL !== null) {
200 self::loginCompleted(
$state);
213 assert(
'is_array($state)');
214 assert(
'array_key_exists("SimpleSAML_Auth_Source.Return", $state)');
215 assert(
'array_key_exists("SimpleSAML_Auth_Source.id", $state)');
216 assert(
'array_key_exists("Attributes", $state)');
217 assert(
'!array_key_exists("LogoutState", $state) || is_array($state["LogoutState"])');
219 $return =
$state[
'SimpleSAML_Auth_Source.Return'];
226 if (is_string($return)) {
229 call_user_func($return,
$state);
250 assert(
'is_array($state)');
266 assert(
'is_array($state)');
267 assert(
'array_key_exists("LogoutCompletedHandler", $state)');
271 $func =
$state[
'LogoutCompletedHandler'];
272 assert(
'is_callable($func)');
274 call_user_func($func,
$state);
293 assert(
'is_string($authId)');
294 assert(
'is_array($config)');
326 assert(
'is_string($authId)');
327 assert(
'is_null($type) || is_string($type)');
333 if ($authConfig === null) {
334 if (
$type !== null) {
336 'No authentication source with id '.
337 var_export(
$authId,
true).
' found.' 343 $ret = self::parseAuthSource(
$authId, $authConfig);
351 'Invalid type of authentication source '.
352 var_export(
$authId,
true).
'. Was '.var_export(get_class(
$ret),
true).
353 ', should be '.var_export($type,
true).
'.' 365 assert(
'is_array($state)');
366 assert(
'array_key_exists("SimpleSAML_Auth_Source.logoutSource", $state)');
373 'Received logout from an invalid authentication source '.
397 assert(
'is_string($assoc)');
398 assert(
'is_array($state)');
400 if (!array_key_exists(
'LogoutCallback',
$state)) {
404 $callback =
$state[
'LogoutCallback'];
406 if (array_key_exists(
'LogoutCallbackState',
$state)) {
407 $callbackState =
$state[
'LogoutCallbackState'];
409 $callbackState =
array();
412 $id = strlen($this->authId).
':'.$this->authId.$assoc;
415 'callback' => $callback,
416 'state' => $callbackState,
421 'SimpleSAML_Auth_Source.LogoutCallbacks',
441 assert(
'is_string($assoc)');
443 $id = strlen($this->authId).
':'.$this->authId.$assoc;
448 if (
$data === null) {
455 assert(
'is_array($data)');
456 assert(
'array_key_exists("callback", $data)');
457 assert(
'array_key_exists("state", $data)');
459 $callback =
$data[
'callback'];
460 $callbackState =
$data[
'state'];
462 $session->deleteData(
'SimpleSAML_Auth_Source.LogoutCallbacks',
$id);
463 call_user_func($callback, $callbackState);
492 'Invalid authentication source \''.
$id.
493 '\': First element must be a
string which identifies the authentication source.
'
const EXCEPTION_HANDLER_URL
The index in the state array which contains the exception handler URL.
logout(&$state)
Log out from this authentication source.
callLogoutCallback($assoc)
Call a logout callback based on association.
static throwException($state, SimpleSAML_Error_Exception $exception)
Throw exception to the state exception handler.
static loginCompleted($state)
Called when a login operation has finished.
if(!array_key_exists('StateId', $_REQUEST)) $id
static parseAuthSource($authId, $config)
Create authentication source object from configuration array.
getAuthId()
Retrieve the ID of this authentication source.
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
static completeLogout(&$state)
Complete logout.
authenticate(&$state)
Process a request.
static validateSource($source, $id)
Make sure that the first element of an auth source is its identifier.
static logoutCallback($state)
Called when the authentication source receives an external logout request.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
const DATA_TIMEOUT_SESSION_END
This is a timeout value for setData, which indicates that the data should never be deleted...
__construct($info, &$config)
Constructor for an authentication source.
addLogoutCallback($assoc, $state)
Add a logout callback association.
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
Create styles array
The data for the language used.
static deleteState(&$state)
Delete state.
static getPersistentAuthData(array $state)
Get the persistent authentication state from the state array.
reauthenticate(array &$state)
Reauthenticate an user.
static getOptionalConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
static completeAuth(&$state)
Complete authentication.
static resolveClass($id, $type, $subclass=null)
Resolve module class.
static getSources()
Retrieve list of authentication sources.
initLogin($return, $errorURL=null, array $params=array())
Start authentication.
static getById($authId, $type=null)
Retrieve authentication source.
static getSessionFromRequest()
Retrieves the current session.
static getSourcesOfType($type)
Get sources of a specific type.