/*
- * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/authenticator/FormAuthenticator.java,v 1.12 2007/11/02 16:31:24 chris_schultz Exp $
- * $Revision: 1.12 $
- * $Date: 2007/11/02 16:31:24 $
+ * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/authenticator/FormAuthenticator.java,v 1.13 2008/04/18 13:08:03 chris_schultz Exp $
+ * $Revision: 1.13 $
+ * $Date: 2008/04/18 13:08:03 $
*
* ====================================================================
* The SecurityFilter Software License, Version 1.1
*
* @author Max Cooper (max@maxcooper.com)
* @author Chris Schultz (chris@christopherschultz.net)
- * @version $Revision: 1.12 $ $Date: 2007/11/02 16:31:24 $
+ * @version $Revision: 1.13 $ $Date: 2008/04/18 13:08:03 $
*/
public class FormAuthenticator implements Authenticator {
*/
public static final String FORWARD_PARAMETERS_PARAMETER_KEY = "forwardParametersParameter";
+
+ /**
+ * The key that will be used to look the filter init parameter
+ * that specifies the character encoding to be used for parameters
+ * forwarded from the login form.
+ */
+ public static final String FORWARD_PARAMETERS_ENCODING_KEY = "forwardParametersEncoding";
+
/**
* The default value for {@link #forwardParameterName}.
*/
public static final String DEFAULT_FORWARD_PARAMETERS_PARAMETER_NAME = "forward-parameters";
/**
+ * The default encoding to be used for forwarded parameters.
+ */
+ public static final String DEFAULT_FORWARD_PARAMETERS_ENCODING = "UTF-8";
+
+ /**
* The name of the request parameter that will be recognized as a
* post-login forward request.
*
*/
protected String forwardParametersParameterName;
+ /**
+ * The character encoding that will be used to encode URL parameters
+ * forwarded through the login page.
+ */
+ protected String forwardParametersEncoding;
+
/**
* Initilize this Authenticator.
*
if(null == forwardParametersParameterName)
forwardParametersParameterName = DEFAULT_FORWARD_PARAMETERS_PARAMETER_NAME;
+ //
+ forwardParametersEncoding = filterConfig.getInitParameter(FORWARD_PARAMETERS_ENCODING_KEY);
+ if(null == forwardParametersEncoding)
+ forwardParametersEncoding = DEFAULT_FORWARD_PARAMETERS_ENCODING;
+
// default page
defaultPage = securityConfig.getDefaultPage();
queryString.append('&');
queryString
- .append(URLEncoder.encode(name, "UTF-8"))
+ .append(URLEncoder.encode(name, forwardParametersEncoding))
.append('=')
- .append(URLEncoder.encode(values[i], "UTF-8"));
+ .append(URLEncoder.encode(values[i], forwardParametersEncoding));
}
}
}