diff --git a/lib/SimpleSAML/Auth/Source.php b/lib/SimpleSAML/Auth/Source.php
index 413f68560c454018ca35a0ecbad7663ea7cca083..267c48df315fc8f11884682e6df2d8a6fb7363a8 100644
--- a/lib/SimpleSAML/Auth/Source.php
+++ b/lib/SimpleSAML/Auth/Source.php
@@ -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.
 	 *