diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index 979b23c1fb283cafb0381bbbe427dd5f5761a1d2..f5b26cadcf89e971e1d42f45ed8136024904ff01 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -615,6 +615,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'];
 		}
@@ -1086,9 +1089,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;
@@ -1110,6 +1118,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;