00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
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 }