You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hardik Shah <ha...@yahoo.com> on 2008/08/26 09:48:43 UTC

realm use in s2

hi

i am trying to use jdbc realm with s2 for that i have configured like that 
 i am using eclipse ,so i have changed in server project 's server.xml file
like this

(first disable the userdatabase realm)
and then applying 

 <Realm  className="org.apache.catalina.realm.JDBCRealm"
             driverName="com.mysql.jdbc.Driver"
          connectionURL="jdbc:mysql://localhost:3306/cfa"
         connectionName="cfa" connectionPassword="cfa"
              userTable="usermast" userNameCol="username"
userCredCol="password"
          userRoleTable="usermast" roleNameCol="user_role" />


after that i have change in my project's web.xml file like that

----------------------------------------------------------
 <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.jtp</url-pattern>
    </filter-mapping>

	<!-- End settings for sitemesh and struts  -->
	<security-constraint>
		<web-resource-collection>
				<web-resource-name>CFASystem</web-resource-name>
				<url-pattern>*.jtp</url-pattern>
				<http-method>GET</http-method>
                <http-method>POST</http-method>
                <http-method>PUT</http-method>
                <http-method>DELETE</http-method>
				
		</web-resource-collection>
	
	</security-constraint>
	
	<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>MyFirst Protected Area</realm-name>
		<form-login-config>
			<form-login-page>/Login.jsp</form-login-page>
			<form-error-page>/error.jsp</form-error-page>
		</form-login-config>
	</login-config>
	<security-role>
		<description> admin user allowed</description>
		<role-name>admin</role-name>
	</security-role>
	<security-role>
		<description>cfa user allowed</description>
		<role-name>cfa</role-name>
	</security-role>
---------------------------------------------------

in login.jsp i have write like 

------------------------------

<form method="POST" action="j_security_check">

				<table width="70%" >
					<tr> 
						<td class="label"><s:text name="Username" /></td>
						<td><s:textfield  name="j_username" cssClass="textbox"  /></td>
					</tr>				
					<tr><td></td></tr>
					<tr> 
						<td class="label"><s:text name="Pasword" /></td>
						<td><s:password name="j_password" showPassword="true"
cssClass="textbox"  /></td>
					</tr>				
					<tr>						
					<td align="right">	
					<s:submit cssClass="button"/>
			  		</td>
					</tr>				
			</table>
			</form>

----------------------


when i try to login this 

gives error like 

HTTP Status 400 - Invalid direct reference to form login page

where i make mistake?
please help me !

it might be not que abt s2 but still expect help!




-----


Java/J2EE developer 
India

blogs
http://hardik4u.wordpress.com wordpress blog 

-- 
View this message in context: http://www.nabble.com/realm-use-in-s2-tp19157022p19157022.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] realm use in s2

Posted by Laurie Harper <la...@holoweb.net>.
This really isn't a Struts issue. You can convince yourself of that by 
removing the Struts tags from your login JSP; you should see the same 
behaviour.

I would start by looking for any additional information in your 
container log files and/or searching the mailing list for you container 
to see if others have encountered the same thing.

L.

Hardik Shah wrote:
> hi
> 
> i am trying to use jdbc realm with s2 for that i have configured like that 
>  i am using eclipse ,so i have changed in server project 's server.xml file
> like this
> 
> (first disable the userdatabase realm)
> and then applying 
> 
>  <Realm  className="org.apache.catalina.realm.JDBCRealm"
>              driverName="com.mysql.jdbc.Driver"
>           connectionURL="jdbc:mysql://localhost:3306/cfa"
>          connectionName="cfa" connectionPassword="cfa"
>               userTable="usermast" userNameCol="username"
> userCredCol="password"
>           userRoleTable="usermast" roleNameCol="user_role" />
> 
> 
> after that i have change in my project's web.xml file like that
> 
> ----------------------------------------------------------
>  <filter-mapping>
>         <filter-name>struts2</filter-name>
>         <url-pattern>*.jtp</url-pattern>
>     </filter-mapping>
> 
> 	<!-- End settings for sitemesh and struts  -->
> 	<security-constraint>
> 		<web-resource-collection>
> 				<web-resource-name>CFASystem</web-resource-name>
> 				<url-pattern>*.jtp</url-pattern>
> 				<http-method>GET</http-method>
>                 <http-method>POST</http-method>
>                 <http-method>PUT</http-method>
>                 <http-method>DELETE</http-method>
> 				
> 		</web-resource-collection>
> 	
> 	</security-constraint>
> 	
> 	<login-config>
> 		<auth-method>FORM</auth-method>
> 		<realm-name>MyFirst Protected Area</realm-name>
> 		<form-login-config>
> 			<form-login-page>/Login.jsp</form-login-page>
> 			<form-error-page>/error.jsp</form-error-page>
> 		</form-login-config>
> 	</login-config>
> 	<security-role>
> 		<description> admin user allowed</description>
> 		<role-name>admin</role-name>
> 	</security-role>
> 	<security-role>
> 		<description>cfa user allowed</description>
> 		<role-name>cfa</role-name>
> 	</security-role>
> ---------------------------------------------------
> 
> in login.jsp i have write like 
> 
> ------------------------------
> 
> <form method="POST" action="j_security_check">
> 
> 				<table width="70%" >
> 					<tr> 
> 						<td class="label"><s:text name="Username" /></td>
> 						<td><s:textfield  name="j_username" cssClass="textbox"  /></td>
> 					</tr>				
> 					<tr><td></td></tr>
> 					<tr> 
> 						<td class="label"><s:text name="Pasword" /></td>
> 						<td><s:password name="j_password" showPassword="true"
> cssClass="textbox"  /></td>
> 					</tr>				
> 					<tr>						
> 					<td align="right">	
> 					<s:submit cssClass="button"/>
> 			  		</td>
> 					</tr>				
> 			</table>
> 			</form>
> 
> ----------------------
> 
> 
> when i try to login this 
> 
> gives error like 
> 
> HTTP Status 400 - Invalid direct reference to form login page
> 
> where i make mistake?
> please help me !
> 
> it might be not que abt s2 but still expect help!
> 
> 
> 
> 
> -----
> 
> 
> Java/J2EE developer 
> India
> 
> blogs
> http://hardik4u.wordpress.com wordpress blog 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org