Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Let me lead with the fact that I don't understand Spring Web MVC well enough.

That said, I think I have some concerns with the CredentialsBinder API and its associated LoginController implementation.

LoginController extends Spring SimpleFormHandler and looks something like this:

  protected ModelAndView processFormSubmission(final HttpServletRequest request, final HttpServletResponse response, final Object object,
        final BindException errors) throws Exception {
        final Credentials credentials = (Credentials)object;
        
        this.credentialsBinder.bind(request, credentials);

        final String ticketGrantingTicketId = this.centralAuthenticationService.createTicketGrantingTicket(credentials);

/**
 * Interface for a class that can bind items stored in the request to a particular
 * credentials implementation.  This allows for binding beyond the basic
 * JavaBean/Request parameter binding that is handled by Spring automatically.
 * 
 * @author Scott Battaglia
 * @version $Id: CredentialsBinder.java,v 1.3 2005/01/25 20:19:12 sbattaglia Exp $
 *
 */
public interface CredentialsBinder {
	/**
	 * Method to allow manually binding attributes from the request object to properties of
	 * the credentials.  Useful when there is no mapping of attribute to property for the 
	 * usual Spring binding to handle.
	 * 
	 * @param request The HttpServletRequest from which we wish to bind credentials to
	 * @param credentials The credentials we will be doing custom binding to.
	 */
	void bind(HttpServletRequest request, Credentials credentials);
	
	/**
	 * 
	 * Method to determine if a CredentialsBinder supports a specific class or not.
	 * 
	 * @param clazz The class to determine is supported or not
	 * @return true if this class is supported by the CredentialsBinder, false otherwise.
	 */
	boolean supports(Class clazz);
}
  • No labels