diff --git a/docs/simplesamlphp-idp.txt b/docs/simplesamlphp-idp.txt
index 06177a7eec4a63a8e76c22e01627715839ad3f7e..d82ba8dcce8910f6b914a461b7ceb2896dd0c366 100644
--- a/docs/simplesamlphp-idp.txt
+++ b/docs/simplesamlphp-idp.txt
@@ -147,6 +147,19 @@ For more information about available options in the idp-hosted metadata
 files, see the [IdP hosted reference](simplesamlphp-reference-idp-hosted).
 
 
+Using the `uri` NameFormat on attributes
+----------------------------------------
+
+It is generally recommended to use the `urn:oasis:names:tc:SAML:2.0:attrname-format:uri` attribute NameFormat in new installations.
+This can be done by adding the following to the saml20-idp-hosted configuration:
+
+    'AttributeNameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
+    'authproc' => array(
+        // Convert LDAP names to oids.
+        100 => array('class' => 'core:AttributeMap', 'name2oid'),
+    ),
+
+
 Adding SPs to the IdP
 ---------------------
 
diff --git a/metadata-templates/saml20-idp-hosted.php b/metadata-templates/saml20-idp-hosted.php
index 57ae0fd5ab793fbe63d2ad2a0732e7620ff8906d..a714a7ec2568f4e38785ef00e251979e3421630b 100644
--- a/metadata-templates/saml20-idp-hosted.php
+++ b/metadata-templates/saml20-idp-hosted.php
@@ -22,4 +22,14 @@ $metadata['__DYNAMIC:1__'] = array(
 	 * 'config/authsources.php'.
 	 */
 	'auth' => 'example-userpass',
+
+	/* Uncomment the following to use the uri NameFormat on attributes. */
+	/*
+	'AttributeNameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
+	'authproc' => array(
+		// Convert LDAP names to oids.
+		100 => array('class' => 'core:AttributeMap', 'name2oid'),
+	),
+	*/
+
 );