username/pass auth handler - initial rev.
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / idp / profile / ProfileRequestDispatcher.java
index dae6fd1..a89d0f3 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.internet2.middleware.shibboleth.idp.profile;
 
-import java.util.Map;
+package edu.internet2.middleware.shibboleth.idp.profile;
 
-import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.springframework.web.servlet.HttpServletBean;
-
-import edu.internet2.middleware.shibboleth.common.profile.ProfileHandler;
+import edu.internet2.middleware.shibboleth.common.profile.BaseServletProfileRequestDispatcher;
+import edu.internet2.middleware.shibboleth.common.profile.ProfileRequest;
+import edu.internet2.middleware.shibboleth.common.profile.ProfileResponse;
 
 /**
- * Servlet responsible for dispatching incoming requests to the appropriate {@link ProfileHandler}.
+ * Servlet responsible for dispatching incoming shibboleth requests to the appropriate profile handler.
  */
-public class ProfileRequestDispatcher extends HttpServletBean {
+public class ProfileRequestDispatcher extends BaseServletProfileRequestDispatcher {
 
     /** Serial version UID. */
-    private static final long serialVersionUID = -8899576775507240060L;
+    private static final long serialVersionUID = -3939942569721369334L;
 
-    /** Registered profile handlers. */
-    private Map<String, ProfileHandler> profileHandlers;
-    
-    /**
-     * Gets the profile handlers currently registered.
-     * 
-     * @return profile handlers currently registered
-     */
-    public Map<String, ProfileHandler> getProfileHandlers(){
-        return profileHandlers;
-    }
-    
-    /**
-     * Sets all the profile handlers to use.
-     * 
-     * @param handlers the profile handlers to use
-     */
-    public void setProfileHandlers(Map<String, ProfileHandler> handlers){
-        profileHandlers = handlers;
+    /** {@inheritDoc} */
+    protected ProfileRequest getProfileRequest(ServletRequest request) {
+        return new ShibbolethProfileRequest((HttpServletRequest) request);
     }
-    
+
     /** {@inheritDoc} */
-    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException{
-        String path = request.getPathInfo();
-        ProfileHandler handler = profileHandlers.get(path);
-        
-        if(handler != null){
-            handler.processRequest(request, response);
-        }
-        
-        // TODO handle case where there is no registered profile
+    protected ProfileResponse getProfileResponse(ServletResponse response) {
+        return new ShibbolethProfileResponse((HttpServletResponse) response);
     }
 }
\ No newline at end of file