Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

ValidatePasswordServlet.java

00001 /*
00002  *        OpenMobileIS - a free Java Framework for mobile applications
00003  *
00004  *   Copyright (C) 2002  Philippe Delrieu.
00005  *
00006  *   This program is free software; you can redistribute it and/or
00007  *   modify it under the terms of the GNU General Public
00008  *   License as published by the Free Software Foundation; either
00009  *   version 2 of the License, or (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *   General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU Library General Public
00017  *   License along with this library; if not, write to the Free
00018  *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  * 
00020  * Philippe Delrieu kept the rigth to distribute all code Copyrighted by philippe Delrieu
00021  *  under other licence term even commercial one.
00022  *  
00023  *  Modifications :
00024  *  2002 Creation P.Delrieu
00025  * 
00026  */
00027 
00028 package org.openmobileis.services.servlet;
00029 
00030 import javax.servlet.ServletException;
00031 import javax.servlet.http.HttpServlet;
00032 import javax.servlet.http.HttpServletRequest;
00033 import javax.servlet.http.HttpServletResponse;
00034 
00035 import org.openmobileis.common.intl.IntlResourceManager;
00036 import org.openmobileis.common.util.log.LogManager;
00037 import org.openmobileis.common.util.log.LogServices;
00038 import org.openmobileis.services.common.ServiceManager;
00039 import org.openmobileis.services.security.SecurityManager;
00040 
00048 public class ValidatePasswordServlet extends HttpServlet {
00049   static final long serialVersionUID = 5521257935120563452L;
00050   private static final String indexUrl="/index";
00051         
00052   public void service( HttpServletRequest req, HttpServletResponse res ) throws ServletException, java.io.IOException {
00053         try     {
00054                 String pass = req.getParameter("password");
00055                 if ((pass==null)||(pass.length() ==0))  {
00056                         req.getSession(true).setAttribute("security.pass.form", IntlResourceManager.getManager().getLocalizedProperty("ValidatePasswordServlet.error.nopassword"));
00057                         ServiceManager.getManager().redirectToServiceURI("/common/showpassform", req, res);
00058                         return;
00059                 }
00060                   
00061                   if (SecurityManager.getManager().validateServicePass(pass)){
00062 //                      SecurityManager.getManager().setServicePass(pass);
00063                         SecurityManager.getManager().setServiceCall();
00064         ServiceManager.getManager().redirectToServiceURI(indexUrl, req, res);
00065                         return;
00066                   }
00067         } catch (Throwable ex)  {
00068                 LogManager.traceError(LogServices.WEBSERVICE, ex);
00069         }
00070                 req.getSession(true).setAttribute("security.pass.form", IntlResourceManager.getManager().getLocalizedProperty("ValidatePasswordServlet.error.badpassword"));
00071     ServiceManager.getManager().redirectToServiceURI("/showpassform", req, res);
00072                 return;
00073   }
00074 
00075 }

Generated on Wed Dec 14 21:05:35 2005 for OpenMobileIS by  doxygen 1.4.4