[jboss-user] [JBoss Portal] - Portlet Login

georgy do-not-reply at jboss.com
Thu Jul 26 04:40:05 EDT 2007


Hi 


I am trying to develop a login portlet. I did (i think) everything  described in the related wiki page :

http://wiki.jboss.org/wiki/Wiki.jsp?page=PortletLogin.

I created two servlets : one to save login/password in session and the second to do the auto login.  My configuration files are :

login.jsp which is displayed when the doView() method of my portletLogin is called 


 <form enctype='application/x-www-form-urlencoded' method='post' action='savelogin'>
  | <input type='text' name='username'>
  | <input type='password' name='password'>
  | <input type='submit' value='login'>
  | </form>
  | 

SaveLogin which is the servlet that should store login and password in session


  | 	protected void doPost(HttpServletRequest request,
  | 			HttpServletResponse response) throws ServletException, IOException {
  | 
  | 	
  | 		String username = request.getParameter("username");
  | 		String password = request.getParameter("password");
  | 		request.getSession().setAttribute("username", username);
  | 		request.getSession().setAttribute("password", password);
  | 		String autologinURL = request.getContextPath() + "/auth/";
  | 		response.sendRedirect(response.encodeRedirectURL(autologinURL));
  | 		
  | 	}
  | 


AutoLogin which is the servlet that dshould do the auto login

  | 	 
  | 		 String username = request.getParameter("username");
  | 		 String password = request.getParameter("password");
  | 		 if (username == null && password == null)
  | 		 {
  | 		 username = (String)request.getSession().getAttribute("username");
  | 		 password = (String)request.getSession().getAttribute("password");
  | 		 }
  | 		 String url ="j_security_check?j_username=" + username + "&j_password=" + password;
  | 		 url = response.encodeRedirectURL(url);
  | 		 response.sendRedirect(url); 
  | 


and the web.xml


  | <?xml version="1.0"?>
  | <!DOCTYPE web-app PUBLIC
  |    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  |    "http://java.sun.com/dtd/web-app_2_3.dtd">
  | <web-app>
  | 
  | 
  | 	<servlet>
  | 		<servlet-name>SaveLogin</servlet-name>
  | 		<description>
  | 			Sauvegarde le login et mot de passe utilisateur en session
  | 		</description>
  | 		<servlet-class>servlet.SaveLogin</servlet-class>
  | 	</servlet>
  | 
  | 	<servlet>
  | 		<servlet-name>AutoLogin</servlet-name>
  | 		<description>
  | 			Fait une redirection vers la jsp login
  | 		</description>
  | 		<servlet-class>servlet.AutoLogin</servlet-class>
  | 	</servlet>
  | 	
  | 	 <servlet-mapping>
  | 		<servlet-name>AutoLogin</servlet-name>
  | 		<url-pattern>/authoLogin</url-pattern>
  | 	</servlet-mapping>	
  | 	 
  | 	<servlet-mapping>
  | 		<servlet-name>SaveLogin</servlet-name>
  | 		<url-pattern>/savelogin</url-pattern>
  | 	</servlet-mapping>
  | 
  | </web-app>
  | 


Here is the problem : after i specify my login/pwd and validate, the doPost() method of SaveLogin is not called. I am sent to the url http://localhost:8080/portal/portal/default/savelogin and nothing else happends.

Does anyone have any idea what the problem is ? The  '<url-pattern>' maybe?

jboss-portal-2.6.1.GA-bundled (default config)
Win XP Pro


Thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067713#4067713

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067713



More information about the jboss-user mailing list