diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index d252af5bd507a4b93cd4a28cb882ea259d6a1995..fcf2ee31ed0d115976f1a78df28af95b4f204032 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -605,6 +605,9 @@ class SimpleSAML_Metadata_SAMLParser {
 		if (array_key_exists('attributes', $spd)) {
 			$ret['attributes'] = $spd['attributes'];
 		}
+		if (array_key_exists('attributes.required', $spd)) {
+			$ret['attributes.required'] = $spd['attributes.required'];
+		}
 		if (array_key_exists('attributes.NameFormat', $spd)) {
 			$ret['attributes.NameFormat'] = $spd['attributes.NameFormat'];
 		}
@@ -1073,9 +1076,14 @@ class SimpleSAML_Metadata_SAMLParser {
 
 		$format = NULL;
 		$sp['attributes'] = array();
+		$sp['attributes.required'] = array();
 		foreach ($element->RequestedAttribute AS $child) {
 			$attrname = $child->Name;
 			$sp['attributes'][] = $attrname;
+			
+			if ($child->isRequired) {
+				$sp['attributes.required'][] = $attrname;
+			}
 
 			if ($child->NameFormat !== NULL) {
 				$attrformat = $child->NameFormat;
@@ -1097,6 +1105,9 @@ class SimpleSAML_Metadata_SAMLParser {
 			 */
 			unset($sp['attributes']);
 		}
+		if (empty($sp['attributes.required'])) {
+			unset($sp['attributes.required']);
+		}
 
 		if ($format !== SAML2_Const::NAMEFORMAT_UNSPECIFIED && $format !== NULL) {
 			$sp['attributes.NameFormat'] = $format;