[jboss-user] [Security & JAAS/JBoss] - Problem with css files in login.jsp page

misqu23 do-not-reply at jboss.com
Tue Jan 13 07:24:46 EST 2009


Hi 

In my webapp I have configured form-based authentication. Here is my the code snippet of my web.xml file :


  | 	<security-constraint>
  | 		<web-resource-collection>
  | 			<web-resource-name>Protected resources</web-resource-name>
  | 			<url-pattern>/restricted/*</url-pattern>
  | 		</web-resource-collection>
  | 		<auth-constraint>
  | 			<role-name>user</role-name>
  | 		</auth-constraint>
  | 		<user-data-constraint>
  | 			<transport-guarantee>NONE</transport-guarantee>
  | 		</user-data-constraint>
  | 	</security-constraint>
  | 		
  | 	<login-config>
  | 		<auth-method>FORM</auth-method>
  | 		<form-login-config>
  | 			<form-login-page>/login.jsp</form-login-page>
  | 			<form-error-page>/error.html</form-error-page>
  | 		</form-login-config>
  | 	</login-config>
  | 	
  | 	<security-role>
  | 		<description>The role required to login to application</description>
  | 		<role-name>user</role-name>
  | 	</security-role>
  | 

Authentication works ok. 
But when I wan't to customize look of the login.jsp page with css and use javascript, insted of css file or js file I get always login.jsp file. It looks like all the resources are protected event outside of the restricted area when I get redirected to the login.jsp. 
When I hit css or js file in the browser I get the correct value. Also when I hit login.jsp directly not through redirect. 

Here is the login.jsp :

 
  | <%@ page language="java" contentType="text/html; charset=UTF-8"
  |     pageEncoding="UTF-8"%>
  | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  | <html>
  | <head>
  | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  | <title>Insert title here</title>
  | 		<link rel="stylesheet" type="text/css" href="login.css" />
  | </head>
  | <body>
  |  <form method="POST" action="<%=request.getContextPath()%>/j_security_check"> 
  |       User: <input type="text" name="j_username" size="15"><br> 
  |       Password: <input type="password" name="j_password" maxlength="20" size="15"><br> 
  |       <INPUT TYPE="SUBMIT" VALUE="Send" > 
  |   </form> 
  | </body>
  | </html>
  | 

Does anybody had similar problem. What am I doing wrong ?

Thanks
Martin

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

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



More information about the jboss-user mailing list