Browse Source

login redirect POST handling bug

jrivard 10 years ago
parent
commit
77077ea1f6

+ 5 - 11
pwm/servlet/src/password/pwm/http/PwmRequest.java

@@ -39,10 +39,7 @@ import password.pwm.error.ErrorInformation;
 import password.pwm.error.PwmError;
 import password.pwm.error.PwmUnrecoverableException;
 import password.pwm.i18n.Message;
-import password.pwm.util.Helper;
-import password.pwm.util.JsonUtil;
-import password.pwm.util.PwmRandom;
-import password.pwm.util.SecureHelper;
+import password.pwm.util.*;
 import password.pwm.util.logging.PwmLogger;
 import password.pwm.ws.server.RestResultBean;
 
@@ -374,6 +371,8 @@ public class PwmRequest extends PwmHttpRequestWrapper implements Serializable {
     }
 
     public void markPreLoginUrl()
+            throws PwmUnrecoverableException
+
     {
         final String originalRequestedUrl = this.getURLwithQueryString();
         if (pwmSession.getSessionStateBean().getOriginalRequestURL() == null) {
@@ -584,13 +583,8 @@ public class PwmRequest extends PwmHttpRequestWrapper implements Serializable {
         this.getHttpServletRequest().getSession().invalidate();
     }
 
-    public String getURLwithQueryString() {
+    public String getURLwithQueryString() throws PwmUnrecoverableException {
         final HttpServletRequest req = this.getHttpServletRequest();
-        final String queryString = req.getQueryString();
-        if (queryString != null && !queryString.isEmpty()) {
-            return req.getRequestURI() + '?' + queryString;
-        } else {
-            return req.getRequestURI();
-        }
+        return ServletHelper.appendAndEncodeUrlParameters(req.getRequestURI(), readParametersAsMap());
     }
 }

+ 9 - 1
pwm/servlet/src/password/pwm/http/servlet/CommandServlet.java

@@ -66,7 +66,15 @@ public class CommandServlet extends PwmServlet {
     {
         final PwmSession pwmSession = pwmRequest.getPwmSession();
 
-        final String action = pwmRequest.readParameterAsString(PwmConstants.PARAM_ACTION_REQUEST);
+        String action = pwmRequest.readParameterAsString(PwmConstants.PARAM_ACTION_REQUEST);
+        if (action.isEmpty()) {
+            String uri = pwmRequest.getHttpServletRequest().getRequestURI();
+            if (uri != null && !uri.toLowerCase().endsWith("command") && !uri.toLowerCase().endsWith("CommandServlet")) {
+                final int lastSlash = uri.lastIndexOf("/");
+                action = uri.substring(lastSlash + 1, uri.length());
+            }
+        }
+
         LOGGER.trace(pwmSession, "received request for action " + action);
 
         if (action.equalsIgnoreCase("idleUpdate")) {

+ 6 - 1
pwm/servlet/src/password/pwm/i18n/Config.properties

@@ -125,6 +125,11 @@ Tooltip_SaveEditorButton=Save changes
 Tooltip_SetConfigPasswordButton=Set configuration password
 Tooltip_OpenReferenceDocButton=Open reference documentation
 Tooltip_OpenMacroHelpButton=Open macro help and reference
+Tooltip_IconSettingsSearch=Search settings, help text and setting values
+Tooltip_IconSearchNoResults=No search results
+Tooltip_IconExpandAll=Expand All
+Tooltip_IconCollapseAll=Collapse All
+Tooltip_IconFilterSettings=Filter Settings
 Tooltip_Setting_Permission_Profile=Specify which of the defined LDAP profiles to use for the associated filter.  If <i>all</i>, all profiles will be checked for the associated filter.  If <i>default</i>, than only the default LDAP Profile will be checked for the associated search filter.
 Tooltip_Setting_Permission_Filter=A valid LDAP search filter.
 Tooltip_Setting_Permission_Base=An optional LDAP Base DN for the search.  If supplied, only users under this LDAP Base DN will be considered a match.
@@ -133,7 +138,7 @@ Tooltip_FormOptions_Required=Marks the field as required.  The user must supply
 Tooltip_FormOptions_Confirm=Adds a duplicate field to the form and requires the value be the same for the original and confirmation field.
 Tooltip_FormOptions_ReadOnly=Make the field unmodifiable.
 Tooltip_FormOptions_Unique=Indicate that the field value must be unique in the directory before proceeding.
-Tooltip_FormOptions_Regex=Apply a <i>regular expression</i> pattern to the value.  The value must match the pattern before the form is completed.  This pattern can be used to constrain the permitted syntax of the value.
+Tooltip_FormOptions_Regex=Apply a regular expression pattern to the value.  The value must match the pattern before the form is completed.  This pattern can be used to constrain the permitted syntax of the value.
 Tooltip_FormOptions_RegexError=Error message to show when the regular expression pattern is not matched.
 Tooltip_FormOptions_Placeholder=Placeholder text to display in the form field with the field is not populated with a value.
 Tooltip_FormOptions_Javascript=Javascript to be added to the browser.

+ 6 - 6
pwm/servlet/web/WEB-INF/jsp/configeditor.jsp

@@ -43,7 +43,7 @@
 <link href="<pwm:context/><pwm:url url='/public/resources/configStyle.css'/>" rel="stylesheet" type="text/css"/>
 <div id="wrapper">
     <div class="configeditor-header" id="header" >
-        <div id="header-center-wide">
+        <div id="header-center-wide" style="min-width: 850px">
             <div id="header-title">
                 <%=PwmConstants.PWM_APP_NAME%> Configuration Editor <span id="currentPageDisplay"></span>
                 <span style="visibility: hidden" id="working_icon" class="headerIcon fa fa-cog fa-spin"></span>
@@ -78,7 +78,7 @@
                 </colgroup>
                 <tr>
                     <td>
-                        <span id="settingSearchIcon" class="fa fa-search"></span>
+                        <span id="settingSearchIcon" class="fa fa-search" title="<pwm:display key="Tooltip_IconSettingsSearch" bundle="Config"/>"></span>
                     </td>
                     <td>
                         <input type="search" id="homeSettingSearch" name="homeSettingSearch" class="inputfield" <pwm:autofocus/>/>
@@ -88,7 +88,7 @@
                             <div id="indicator-searching" style="display: none">
                                 <span style="" class="fa fa-lg fa-spin fa-spinner"></span>
                             </div>
-                            <div id="indicator-noResults" style="display: none;">
+                            <div id="indicator-noResults" style="display: none;" title="<pwm:display key="Tooltip_IconSearchNoResults" bundle="Config"/>">
                                 <span style="color: #ffcd59;" class="fa fa-lg fa-ban"></span>
                             </div>
                         </div>
@@ -104,11 +104,11 @@
                 <%-- navtree goes here --%>
             </div>
             <div id="navTreeExpanderButtons">
-                <span id="button-navigationExpandAll" class="fa fa-plus-square"></span>
+                <span id="button-navigationExpandAll" class="fa fa-plus-square" title="<pwm:display key="Tooltip_IconExpandAll" bundle="Config"/>"></span>
                 &nbsp;&nbsp;
-                <span id="button-navigationCollapseAll" class="fa fa-minus-square"></span>
+                <span id="button-navigationCollapseAll" class="fa fa-minus-square" title="<pwm:display key="Tooltip_IconCollapseAll" bundle="Config"/>"></span>
                 &nbsp;&nbsp;
-                <div class="headerIcon" id="settingFilter_icon">
+                <div class="headerIcon" id="settingFilter_icon" title="<pwm:display key="Tooltip_IconFilterSettings" bundle="Config"/>">
                     <span class="fa fa-filter"></span>
                 </div>
             </div>

+ 6 - 0
pwm/servlet/web/WEB-INF/web.xml

@@ -335,6 +335,12 @@
         <servlet-name>CommandServlet</servlet-name>
         <url-pattern>/public/CommandServlet</url-pattern>
         <url-pattern>/private/CommandServlet</url-pattern>
+        <url-pattern>/public/command</url-pattern>
+        <url-pattern>/private/command</url-pattern>
+        <url-pattern>/public/CommandServlet/*</url-pattern>
+        <url-pattern>/private/CommandServlet/*</url-pattern>
+        <url-pattern>/public/command/*</url-pattern>
+        <url-pattern>/private/command/*</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>NewUserServlet</servlet-name>

+ 9 - 45
pwm/servlet/web/public/resources/js/configeditor-settings.js

@@ -751,23 +751,23 @@ FormTableHandler.showOptionsDialog = function(keyName, iteration) {
         var bodyText = '<div style="max-height: 500px; overflow-y: auto"><table class="noborder">';
         bodyText += '<tr>';
         var descriptionValue = PWM_VAR['clientSettingCache'][keyName][iteration]['description'][''];
-        bodyText += '<td id="' + inputID + '-label-description" class="key">Description</td><td>';
+        bodyText += '<td id="' + inputID + '-label-description" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Description') + '">Description</td><td>';
         bodyText += '<div class="noWrapTextBox" id="' + inputID + 'description"><span class="btn-icon fa fa-edit"></span><span>' + descriptionValue + '...</span></div>';
         bodyText += '</td>';
 
         bodyText += '</tr><tr>';
         if (options['required'] != 'hide') {
-            bodyText += '<td id="' + inputID + '-label-required" class="key">Required</td><td><input type="checkbox" id="' + inputID + 'required' + '"/></td>';
+            bodyText += '<td id="' + inputID + '-label-required" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Required') + '">Required</td><td><input type="checkbox" id="' + inputID + 'required' + '"/></td>';
             bodyText += '</tr><tr>';
         }
-        bodyText += '<td id="' + inputID + '-label-confirm" class="key">Confirm</td><td><input type="checkbox" id="' + inputID + 'confirmationRequired' + '"/></td>';
+        bodyText += '<td id="' + inputID + '-label-confirm" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Confirm') + '">Confirm</td><td><input type="checkbox" id="' + inputID + 'confirmationRequired' + '"/></td>';
         bodyText += '</tr><tr>';
         if (options['readonly'] == 'show') {
-            bodyText += '<td id="' + inputID + '-label-readOnly" class="key">Read Only</td><td><input type="checkbox" id="' + inputID + 'readonly' + '"/></td>';
+            bodyText += '<td id="' + inputID + '-label-readOnly" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_ReadOnly') + '">Read Only</td><td><input type="checkbox" id="' + inputID + 'readonly' + '"/></td>';
             bodyText += '</tr><tr>';
         }
         if (showUnique) {
-            bodyText += '<td id="' + inputID + '-label-unique" class="key">Unique</td><td><input type="checkbox" id="' + inputID + 'unique' + '"/></td>';
+            bodyText += '<td id="' + inputID + '-label-unique" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Unique') + '">Unique</td><td><input type="checkbox" id="' + inputID + 'unique' + '"/></td>';
             bodyText += '</tr><tr>';
         }
         bodyText += '<td class="key">Minimum Length</td><td><input type="number" id="' + inputID + 'minimumLength' + '"/></td>';
@@ -776,18 +776,18 @@ FormTableHandler.showOptionsDialog = function(keyName, iteration) {
         bodyText += '</tr><tr>';
 
         { // regex
-            bodyText += '<td id="' + inputID + '-label-regex" class="key">Regular Expression</td><td><input type="text" class="configStringInput" id="' + inputID + 'regex' + '"/></td>';
+            bodyText += '<td id="' + inputID + '-label-regex" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Regex') + '">Regular Expression</td><td><input type="text" class="configStringInput" id="' + inputID + 'regex' + '"/></td>';
             bodyText += '</tr><tr>';
 
             var regexErrorValue = PWM_VAR['clientSettingCache'][keyName][iteration]['regexErrors'][''];
-            bodyText += '<td id="' + inputID + '-label-regexError" class="key">Regular Expression<br/>Error Message</td><td>';
+            bodyText += '<td id="' + inputID + '-label-regexError" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_RegexError') + '">Regular Expression<br/>Error Message</td><td>';
             bodyText += '<div class="noWrapTextBox" id="' + inputID + 'regexErrors"><span class="btn-icon fa fa-edit"></span><span>' + regexErrorValue + '...</span></div>';
             bodyText += '</td>';
             bodyText += '</tr><tr>';
         }
-        bodyText += '<td id="' + inputID + '-label-placeholder" class="key">Placeholder</td><td><input type="text" id="' + inputID + 'placeholder' + '"/></td>';
+        bodyText += '<td id="' + inputID + '-label-placeholder" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Placeholder') + '">Placeholder</td><td><input type="text" id="' + inputID + 'placeholder' + '"/></td>';
         bodyText += '</tr><tr>';
-        bodyText += '<td id="' + inputID + '-label-js" class="key">JavaScript</td><td><input type="text" id="' + inputID + 'javascript' + '"/></td>';
+        bodyText += '<td id="' + inputID + '-label-js" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Javascript') + '">JavaScript</td><td><input type="text" id="' + inputID + 'javascript' + '"/></td>';
         bodyText += '</tr><tr>';
         if (PWM_VAR['clientSettingCache'][keyName][iteration]['type'] == 'select') {
             bodyText += '<td class="key">Select Options</td><td><button id="' + inputID + 'editOptionsButton"><span class="btn-icon fa fa-list-ul"/> Edit</button></td>';
@@ -796,42 +796,6 @@ FormTableHandler.showOptionsDialog = function(keyName, iteration) {
         bodyText += '</table></div>';
 
         var initDialogWidgets = function() {
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-description',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_Description')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-required',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_Required')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-confirm',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_Confirm')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-readOnly',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_ReadOnly')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-unique',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_Unique')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-regex',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_Regex')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-regexError',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_RegexError')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-placeholder',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_Placeholder')
-            });
-            PWM_MAIN.showTooltip({
-                id: inputID + '-label-js',
-                text: PWM_CONFIG.showString('Tooltip_FormOptions_Javascript')
-            });
 
             PWM_MAIN.addEventHandler(inputID + 'editOptionsButton', 'click', function(){
                 FormTableHandler.showSelectOptionsDialog(keyName,iteration);

+ 0 - 3
pwm/servlet/web/public/resources/js/configeditor.js

@@ -305,9 +305,6 @@ PWM_CFGEDIT.initConfigEditor = function(nextFunction) {
     PWM_MAIN.addEventHandler('button-navigationExpandAll','click',function(){PWM_VAR['navigationTree'].expandAll()});
     PWM_MAIN.addEventHandler('button-navigationCollapseAll','click',function(){PWM_VAR['navigationTree'].collapseAll()});
 
-    PWM_MAIN.showTooltip({id:'settingSearchIcon',text:'Search settings, help text and setting values',position:'above'});
-    PWM_MAIN.showTooltip({id:'indicator-noResults',text:'No search results',position:'above'});
-
     PWM_MAIN.addEventHandler('cancelButton_icon','click',function(){PWM_CFGEDIT.cancelEditing()});
     PWM_MAIN.addEventHandler('saveButton_icon','click',function(){PWM_CFGEDIT.saveConfiguration()});
     PWM_MAIN.addEventHandler('setPassword_icon','click',function(){PWM_CFGEDIT.setConfigurationPassword()});