49 assert(
'is_array($idpMetadata)');
50 assert(
'is_array($spMetadata)');
52 $this->filters =
array();
55 $configauthproc =
$config->getArray(
'authproc.' . $mode, NULL);
57 if (!empty($configauthproc)) {
58 $configfilters = self::parseFilterList($configauthproc);
59 self::addFilters($this->filters, $configfilters);
63 $idpFilters = self::parseFilterList(
$idpMetadata[
'authproc']);
64 self::addFilters($this->filters, $idpFilters);
68 $spFilters = self::parseFilterList(
$spMetadata[
'authproc']);
69 self::addFilters($this->filters, $spFilters);
74 $spMetadata[
'entityid'] .
': ' . str_replace(
"\n",
'', var_export($this->filters, TRUE)));
88 assert(
'is_array($target)');
89 assert(
'is_array($src)');
91 foreach ($src as $filter) {
92 $fp = $filter->priority;
115 assert(
'is_array($filterSrc)');
117 $parsedFilters =
array();
119 foreach ($filterSrc as $priority => $filter) {
121 if (is_string($filter)) {
122 $filter =
array(
'class' => $filter);
125 if (!is_array($filter)) {
126 throw new Exception(
'Invalid authentication processing filter configuration: ' .
127 'One of the filters wasn\'t a string or an array.');
130 $parsedFilters[] = self::parseFilter($filter, $priority);
133 return $parsedFilters;
146 assert(
'is_array($config)');
148 if (!array_key_exists(
'class',
$config))
149 throw new Exception(
'Authentication processing filter without name given.');
152 $config[
'%priority'] = $priority;
154 return new $className(
$config, NULL);
179 assert(
'is_array($state)');
180 assert(
'array_key_exists("ReturnURL", $state) || array_key_exists("ReturnCall", $state)');
181 assert(
'!array_key_exists("ReturnURL", $state) || !array_key_exists("ReturnCall", $state)');
188 if (!array_key_exists(
'UserID',
$state)) {
193 while (count(
$state[self::FILTERS_INDEX]) > 0) {
194 $filter = array_shift(
$state[self::FILTERS_INDEX]);
225 assert(
'is_array($state)');
227 while (count(
$state[self::FILTERS_INDEX]) > 0) {
228 $filter = array_shift(
$state[self::FILTERS_INDEX]);
241 assert(
'array_key_exists("ReturnURL", $state) || array_key_exists("ReturnCall", $state)');
242 assert(
'!array_key_exists("ReturnURL", $state) || !array_key_exists("ReturnCall", $state)');
245 if (array_key_exists(
'ReturnURL',
$state)) {
258 $func =
$state[
'ReturnCall'];
259 assert(
'is_callable($func)');
261 call_user_func($func,
$state);
278 assert(
'is_array($state)');
280 assert(
'!array_key_exists("ReturnURL", $state)');
283 $state[
'isPassive'] = TRUE;
288 if (!array_key_exists(
'UserID',
$state)) {
293 while (count(
$state[self::FILTERS_INDEX]) > 0) {
294 $filter = array_shift(
$state[self::FILTERS_INDEX]);
311 assert(
'is_string($id)');
321 assert(
'is_array($state)');
322 assert(
'array_key_exists("Attributes", $state)');
324 if (isset(
$state[
'Destination'][
'userid.attribute'])) {
325 $attributeName =
$state[
'Destination'][
'userid.attribute'];
327 } elseif (isset(
$state[
'Source'][
'userid.attribute'])) {
328 $attributeName =
$state[
'Source'][
'userid.attribute'];
332 $attributeName =
'eduPersonPrincipalName';
335 if (!array_key_exists($attributeName,
$state[
'Attributes'])) {
339 $uid =
$state[
'Attributes'][$attributeName];
340 if (count($uid) === 0) {
345 if (count($uid) > 1) {
static addFilters(&$target, $src)
Sort & merge filter configuration.
static throwException($state, SimpleSAML_Error_Exception $exception)
Throw exception to the state exception handler.
processState(&$state)
Process the given state.
if(!array_key_exists('StateId', $_REQUEST)) $id
processStatePassive(&$state)
Process the given state passivly.
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
static resumeProcessing($state)
Continues processing of the state.
const AUTHPARAM
The request parameter we will use to pass the state identifier when we redirect after having complete...
static parseFilter($config, $priority)
Parse an authentication processing filter.
Class SimpleSAML_Error_NoPassive.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
__construct($idpMetadata, $spMetadata, $mode='idp')
Initialize an authentication processing chain for the given service provider and identity provider...
static parseFilterList($filterSrc)
Parse an array of authentication processing filters.
$filters
All authentication processing filters, in the order they should be applied.
static fetchProcessedState($id)
Retrieve a state which has finished processing.
static loadState($id, $stage, $allowMissing=false)
Retrieve saved state.
Create styles array
The data for the language used.
static deleteState(&$state)
Delete state.
static addUserID(&$state)
const FILTERS_INDEX
The list of remaining filters which should be applied to the state.
static resolveClass($id, $type, $subclass=null)
Resolve module class.
const COMPLETED_STAGE
The stage we use for completed requests.
static saveState(&$state, $stage, $rawId=false)
Save the state.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.