You can use the PropertyEditor to convert Strings to more Strings (see the
String Trimmer example in the Spring source).

You can extend the AuthenticationViaForm class, similar to this example
below (but you'll be calling the method to register the property editors on
the DataBinder):

package edu.rutgers.enterprise.cas.web.flow;

import org.jasig.cas.web.flow.AuthenticationViaFormAction;
import org.springframework.validation.DataBinder;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.webflow.execution.RequestContext;


public class RestrictedAuthenticationViaFormAction extends
    AuthenticationViaFormAction {

    protected void initBinder(RequestContext arg0, DataBinder binder) {
        final WebDataBinder webBinder = (WebDataBinder) binder;
        binder.setAllowedFields(new String[] {"username", "password",
"authenticationType"});
        webBinder.setFieldMarkerPrefix(null);
    }
}

JavaDoc:
http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/validation/DataBinder.html#registerCustomEditor(java.lang.Class,%20java.lang.String,%20java.beans.PropertyEditor)

There is also another way to do it via the Spring configuration but I'm not
too familiar with that.

-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: http://www.linkedin.com/in/scottbattaglia


On Tue, Sep 9, 2008 at 2:53 PM, Andrew Ralph Feller, afelle1 <
[EMAIL PROTECTED]> wrote:

>  Scott,
>
> Could you elaborate further?  The Spring documentation about using
> PropertyEditors (
> http://static.springframework.org/spring/docs/2.5.x/reference/validation.html#beans-beans-conversion-customeditor-registration)
>  is confusing as it uses the context of converting Strings to Objects.  The
> Spring WebFlow documentation for the FormAction class mentions a
> PropertyEditorRegistrar can be associated with the FormAction (
> http://static.springframework.org/spring-webflow/docs/1.0.x/api/org/springframework/webflow/action/FormAction.html#setPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar<http://static.springframework.org/spring-webflow/docs/1.0.x/api/org/springframework/webflow/action/FormAction.html#setPropertyEditorRegistrar%28org.springframework.beans.PropertyEditorRegistrar>).
>
> This definitely seems overly complicated for something that should be
> simple. =vC
>
> Thanks,
> Andrew
>
> On 9/9/08 10:01 AM, "Scott Battaglia" <[EMAIL PROTECTED]> wrote:
>
> Andrew,
>
> You should be able to register a custom PropertyEditor that you apply to
> the particular Credentials property (i.e. "username").  The PropertyEditor
> can lowercase the provided text.
>
> -Scott
>
> -Scott Battaglia
> PGP Public Key Id: 0x383733AA
> LinkedIn: http://www.linkedin.com/in/scottbattaglia
>
>
> On Tue, Sep 9, 2008 at 10:46 AM, Andrew Ralph Feller, afelle1 <
> [EMAIL PROTECTED]> wrote:
>
> QUESTION: What is the recommended method of manipulating login form fields
> such as username in CAS 3.X: CAS' CredentialsBinder or Spring's DataBinder
> or PropertyEditor?
>
> Thanks,
> Andrew
>
>
> --
> Andrew R. Feller, Analyst
> Information Technology Services
> 200 Fred Frey Building
> Louisiana State University
> Baton Rouge, LA 70803
> (225) 578-3737 (Office)
> (225) 578-6400 (Fax)
>
> _______________________________________________
> Yale CAS mailing list
> [email protected]
> http://tp.its.yale.edu/mailman/listinfo/cas
>
>
_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

Reply via email to