Skip to content
Snippets Groups Projects
Commit a1d85164 authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_Auth_Source: Add getSourcesOfType().

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1739 44740490-163a-0410-bde0-09ae8108e29a
parent b058cf6b
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,39 @@ abstract class SimpleSAML_Auth_Source { ...@@ -38,6 +38,39 @@ abstract class SimpleSAML_Auth_Source {
} }
/**
* Get sources of a specific type.
*
* @param string $type The type of the authentication source.
* @return array Array of SimpleSAML_Auth_Source objects of the specified type.
*/
public static function getSourcesOfType($type) {
assert('is_string($type)');
$config = SimpleSAML_Configuration::getConfig('authsources.php');
$ret = array();
$sources = $config->getOptions();
foreach ($sources as $id) {
$source = $config->getArray($id);
if (!array_key_exists(0, $source) || !is_string($source[0])) {
throw new Exception('Invalid authentication source \'' . $authId .
'\': First element must be a string which identifies the authentication source.');
}
if ($source[0] !== $type) {
continue;
}
$ret[] = self::parseAuthSource($id, $source);
}
return $ret;
}
/** /**
* Process a request. * Process a request.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment