From 87024341c4da9c859ed9880d254b7fab8a24c7c9 Mon Sep 17 00:00:00 2001
From: Patrick Radtke <patrick@cirrusidentity.com>
Date: Fri, 12 Oct 2018 15:42:21 -0700
Subject: [PATCH] Update core:PHP doc to discuss $state variable

---
 modules/core/docs/authproc_php.md | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/core/docs/authproc_php.md b/modules/core/docs/authproc_php.md
index 66968eda1..b913d8fe6 100644
--- a/modules/core/docs/authproc_php.md
+++ b/modules/core/docs/authproc_php.md
@@ -1,7 +1,7 @@
 `core:PHP`
 ==========
 
-This is a filter which makes it possible to run arbitrary PHP code to modify the attributes of an user.
+This is a filter which makes it possible to run arbitrary PHP code to modify the attributes or state of an user.
 
 Parameters
 ----------
@@ -11,8 +11,14 @@ Parameters
     It must be `'core:PHP'`.
 
 `code`
-:   The PHP code that should be run. This code will have only one variable available: `$attributes`.
+:   The PHP code that should be run. This code will have two variables available: 
+
+* `$attributes`.
     This is an associative array of attributes, and can be modified to add or remove attributes.
+    
+* `$state`.
+    This is an associative array of request state. It can be modified to adjust data related to the authentication
+    such as desired NameId, requested Attributes, authnContextRef and many more.
 
 Examples
 --------
@@ -43,3 +49,10 @@ Create a random number variable:
             );
         ',
     ),
+
+Force a specific NameIdFormat. Useful if an SP misbehaves and requests (or publishes) an incorrect NameId
+
+    90 => array(
+         'class' => 'core:PHP',
+         'code' => '$state["saml:NameIDFormat"] = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient";'
+    ),
\ No newline at end of file
-- 
GitLab