Added option to control expiration of re-post form, and Jim's Javascript code.
authorScott Cantor <cantor.2@osu.edu>
Fri, 13 Mar 2009 19:29:38 +0000 (19:29 +0000)
committerScott Cantor <cantor.2@osu.edu>
Fri, 13 Mar 2009 19:29:38 +0000 (19:29 +0000)
configs/postTemplate.html
schemas/shibboleth-2.0-native-sp-config.xsd
shibsp/handler/impl/AbstractHandler.cpp

index 553c28d..4883feb 100644 (file)
@@ -1,24 +1,41 @@
 <html>
-       <head>
-               <title>Login Completed</title>
-       </head>
-       <body onload="document.forms[0].submit()">
-        <h1>Login Completed</h1>
+    <head>
+        <title>Login Completed</title>
+        <script language="Javascript">
+        <!--
+        function submitOnce() {
+          if (location.hash.length>0) {
+             if (confirm("Are you sure you want to resubmit this form information a second time?")) {
+                document.forms[0].submit();
+             } else {
+                document.body.innerHTML="<html>Form information was not resubmitted.</html>";
+             }
+          } else {
+             var loc = window.location;
+             window.location = loc + "#submitted";
+             document.forms[0].submit();
+          }
+        }
+        // -->
+        </script>
+    </head>
+    <body onload="submitOnce()">
+        <h2>Login Completed</h2>
 
         <noscript>
         <p>A form submission to this site was interrupted by the login process.
         If you would like to complete it now, submit this form.</p>
         </noscript>
-       
-               <form method="POST" action="<shibmlp action/>">
-               <shibmlpfor PostedData>
-                       <input type="hidden" name="<shibmlp $name/>" value="<shibmlp $value/>"/>
-               </shibmlpfor>
-               <noscript>
-               <div>
-               <input type="submit" name="_shib_continue_" value="Continue"/>
-               </div>
-               </noscript>
-               </form>
-       </body>
+        
+        <form method="POST" action="<shibmlp action/>">
+        <shibmlpfor PostedData>
+            <input type="hidden" name="<shibmlp $name/>" value="<shibmlp $value/>"/>
+        </shibmlpfor>
+        <noscript>
+        <div>
+        <input type="submit" name="_shib_continue_" value="Continue"/>
+        </div>
+        </noscript>
+        </form>
+    </body>
 </html>
index 56411b7..29db543 100644 (file)
                        <attribute name="postData" type="conf:string"/>\r
             <attribute name="postLimit" type="positiveInteger"/>\r
                        <attribute name="postTemplate" type="conf:string"/>\r
+            <attribute name="postExpire" type="boolean"/>\r
                        <anyAttribute namespace="##other" processContents="lax"/>\r
                </complexType>\r
        </element>\r
index 510b6ff..c26acdc 100644 (file)
@@ -576,10 +576,14 @@ long AbstractHandler::sendPostResponse(
     stringstream str;
     XMLToolingConfig::getConfig().getTemplateEngine()->run(infile, str, respParam);
 
+    pair<bool,bool> postExpire = props->getBool("postExpire");
+
     httpResponse.setContentType("text/html");
-    httpResponse.setResponseHeader("Expires", "01-Jan-1997 12:00:00 GMT");
-    httpResponse.setResponseHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
-    httpResponse.setResponseHeader("Pragma", "no-cache");
+    if (!postExpire.first || postExpire.second) {
+        httpResponse.setResponseHeader("Expires", "01-Jan-1997 12:00:00 GMT");
+        httpResponse.setResponseHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
+        httpResponse.setResponseHeader("Pragma", "no-cache");
+    }
     return httpResponse.sendResponse(str);
 }