54 $this->filters = array();
57 $configauthproc =
$config->getArray(
'authproc.' . $mode, null);
59 if (!empty($configauthproc)) {
60 $configfilters = self::parseFilterList($configauthproc);
61 self::addFilters($this->filters, $configfilters);
65 $idpFilters = self::parseFilterList(
$idpMetadata[
'authproc']);
66 self::addFilters($this->filters, $idpFilters);
70 $spFilters = self::parseFilterList(
$spMetadata[
'authproc']);
71 self::addFilters($this->filters, $spFilters);
76 $spMetadata[
'entityid'] .
': ' . str_replace(
"\n",
'', var_export($this->filters,
true)));
91 assert(is_array($src));
93 foreach ($src as $filter) {
94 $fp = $filter->priority;
104 array_splice(
$target,
$i+1, 0, array($filter));
117 assert(is_array($filterSrc));
119 $parsedFilters = array();
121 foreach ($filterSrc as $priority => $filter) {
122 if (is_string($filter)) {
123 $filter = array(
'class' => $filter);
126 if (!is_array($filter)) {
127 throw new Exception(
'Invalid authentication processing filter configuration: ' .
128 'One of the filters wasn\'t a string or an array.');
131 $parsedFilters[] = self::parseFilter($filter, $priority);
134 return $parsedFilters;
150 if (!array_key_exists(
'class',
$config)) {
151 throw new Exception(
'Authentication processing filter without name given.');
155 $config[
'%priority'] = $priority;
157 return new $className(
$config, null);
184 assert(array_key_exists(
'ReturnURL',
$state) || array_key_exists(
'ReturnCall',
$state));
185 assert(!array_key_exists(
'ReturnURL',
$state) || !array_key_exists(
'ReturnCall',
$state));
191 if (!array_key_exists(
'UserID',
$state)) {
196 while (count(
$state[self::FILTERS_INDEX]) > 0) {
197 $filter = array_shift(
$state[self::FILTERS_INDEX]);
230 while (count(
$state[self::FILTERS_INDEX]) > 0) {
231 $filter = array_shift(
$state[self::FILTERS_INDEX]);
244 assert(array_key_exists(
'ReturnURL',
$state) || array_key_exists(
'ReturnCall',
$state));
245 assert(!array_key_exists(
'ReturnURL',
$state) || !array_key_exists(
'ReturnCall',
$state));
248 if (array_key_exists(
'ReturnURL',
$state)) {
261 $func =
$state[
'ReturnCall'];
262 assert(is_callable($func));
264 call_user_func($func,
$state);
284 assert(!array_key_exists(
'ReturnURL',
$state));
287 $state[
'isPassive'] =
true;
292 if (!array_key_exists(
'UserID',
$state)) {
297 while (count(
$state[self::FILTERS_INDEX]) > 0) {
298 $filter = array_shift(
$state[self::FILTERS_INDEX]);
305 }
catch (\
SimpleSAML\Module\saml\Error\NoPassive $e) {
320 assert(is_string(
$id));
332 assert(array_key_exists(
'Attributes',
$state));
334 if (isset(
$state[
'Destination'][
'userid.attribute'])) {
335 $attributeName =
$state[
'Destination'][
'userid.attribute'];
337 } elseif (isset(
$state[
'Source'][
'userid.attribute'])) {
338 $attributeName =
$state[
'Source'][
'userid.attribute'];
342 $attributeName =
'eduPersonPrincipalName';
345 if (!array_key_exists($attributeName,
$state[
'Attributes'])) {
349 $uid =
$state[
'Attributes'][$attributeName];
350 if (count($uid) === 0) {
355 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.
Attribute-related utility methods.
__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.
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.