From 603020c1caba0c4d0f56ca1294c3761a0558d28d Mon Sep 17 00:00:00 2001
From: Thijs Kinkhorst <thijs@kinkhorst.com>
Date: Mon, 14 Nov 2016 13:47:20 +0000
Subject: [PATCH] Deprecate the core:AttributeRealm module.

`core:ScopeFromAttribute` is a generalised version of this.

Closes: #512
---
 config-templates/config.php                      | 3 ---
 docs/simplesamlphp-authproc.md                   | 5 ++---
 modules/core/docs/authproc_attributerealm.md     | 3 +++
 modules/core/lib/Auth/Process/AttributeRealm.php | 1 +
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/config-templates/config.php b/config-templates/config.php
index fcb1ffaaf..6cf0865e1 100644
--- a/config-templates/config.php
+++ b/config-templates/config.php
@@ -767,9 +767,6 @@ $config = array(
         // Adopts language from attribute to use in UI
         30 => 'core:LanguageAdaptor',
 
-        /* Add a realm attribute from edupersonprincipalname
-        40 => 'core:AttributeRealm',
-         */
         45 => array(
             'class'         => 'core:StatisticsWithAttribute',
             'attributename' => 'realm',
diff --git a/docs/simplesamlphp-authproc.md b/docs/simplesamlphp-authproc.md
index 784ae9e08..863a88071 100644
--- a/docs/simplesamlphp-authproc.md
+++ b/docs/simplesamlphp-authproc.md
@@ -50,7 +50,6 @@ The configuration of *Auth Proc Filters* is a list of filters with priority as *
 			'addurnprefix'
 		),
 		20 => 'core:TargetedID',
-		40 => 'core:AttributeRealm',
 		50 => 'core:AttributeLimit',
 		90 => array(
 			'class' 	=> 'consent:Consent', 
@@ -112,7 +111,7 @@ Filters can be added both in `hosted` and `remote` metadata. Here is an example
 		'certificate'		=>	'example.org.crt',
 		'auth'				=>	'feide',
 		'authproc' => array(
-			40 => 'core:AttributeRealm',
+			40 => 'preprodwarning:Warning',
 		),
 	)
 
@@ -132,7 +131,7 @@ The following filters are included in the SimpleSAMLphp distribution:
 - [`core:AttributeAlter`](./core:authproc_attributealter): Do search-and-replace on attributevalues.
 - [`core:AttributeLimit`](./core:authproc_attributelimit): Limit the attributes in the response.
 - [`core:AttributeMap`](./core:authproc_attributemap): Change the name of the attributes.
-- [`core:AttributeRealm`](./core:authproc_attributerealm): Create an attribute with the realm of the user.
+- [`core:AttributeRealm`](./core:authproc_attributerealm): (deprecated) Create an attribute with the realm of the user.
 - [`core:GenerateGroups`](./core:authproc_generategroups): Generate a `group` attribute for the user.
 - [`core:LanguageAdaptor`](./core:authproc_languageadaptor): Transfering language setting from IdP to SP.
 - [`core:PHP`](./core:authproc_php): Modify attributes with custom PHP code.
diff --git a/modules/core/docs/authproc_attributerealm.md b/modules/core/docs/authproc_attributerealm.md
index 77b0bb31c..cf511772a 100644
--- a/modules/core/docs/authproc_attributerealm.md
+++ b/modules/core/docs/authproc_attributerealm.md
@@ -1,6 +1,9 @@
 `core:AttributeRealm`
 =====================
 
+*NOTE:* This filter has been deprecated and will be removed in a future release. Please use
+`core:ScopeFromAttribute` instead.
+
 This filter creates a new attribute with the realm of the user.
 
 The new attribute is names `realm` by default, but can be controlled by the `attributename` option.
diff --git a/modules/core/lib/Auth/Process/AttributeRealm.php b/modules/core/lib/Auth/Process/AttributeRealm.php
index 75b652a64..9e50d78a4 100644
--- a/modules/core/lib/Auth/Process/AttributeRealm.php
+++ b/modules/core/lib/Auth/Process/AttributeRealm.php
@@ -6,6 +6,7 @@
  *
  * @author Andreas Ă…kre Solberg, UNINETT AS.
  * @package SimpleSAMLphp
+ * @deprecated Use ScopeFromAttribute instead.
  */
 class sspmod_core_Auth_Process_AttributeRealm extends SimpleSAML_Auth_ProcessingFilter {
 
-- 
GitLab