Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Application Controlled Authentication - Tomcat & Struts

Reply
Thread Tools

Application Controlled Authentication - Tomcat & Struts

 
 
Antoine Diot
Guest
Posts: n/a
 
      05-27-2004
Hello All. Thanks in advance for your help.

I'm trying to implement Application controlled security in conjunction
with the <security-constraint> option in web.xml. I'm using Struts
1.1 and Tomcat 5.0.24.Here's what I got.

web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Area</web-resource-name>
<url-pattern>/secure/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</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>/loginError.jsp</form-error-page>
</form-login-config>
</login-config>

struts-config.xml:
<form-beans>
<form-bean name="LoginForm" type="forms.LoginForm"/>
</form-beans>
...
<action
path="/Login"
type="actions.LoginAction"
name="LoginForm"
scope="request"
validate="true"
input="/login.jsp">
</action>

The LoginAction class takes care of authentication using the values in
LoginForm successfully. My question is, if the user request something
with /secure in it's path, for example, /secure/page1, how do I
forward to the originally requested page after the user is
authenticated successfully. Normally I would return an ActionForward
object that forwards to the requested page, but I'm not sure how to
figure out what the requested page is from within the LoginAction
object.
 
Reply With Quote
 
 
 
 
Rajesh Tihari
Guest
Posts: n/a
 
      05-28-2004
You can also try out CAS. It is available at http://www.yale.edu/tp/auth/
It is an excellent Open Source Single Sign On product.

Cheers
Rajesh

(Antoine Diot) wrote in message news:<. com>...
> Hello All. Thanks in advance for your help.
>
> I'm trying to implement Application controlled security in conjunction
> with the <security-constraint> option in web.xml. I'm using Struts
> 1.1 and Tomcat 5.0.24.Here's what I got.
>
> web.xml:
> <security-constraint>
> <web-resource-collection>
> <web-resource-name>Secure Area</web-resource-name>
> <url-pattern>/secure/*</url-pattern>
> <http-method>DELETE</http-method>
> <http-method>GET</http-method>
> <http-method>POST</http-method>
> <http-method>PUT</http-method>
> </web-resource-collection>
> <auth-constraint>
> <role-name>admin</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>/loginError.jsp</form-error-page>
> </form-login-config>
> </login-config>
>
> struts-config.xml:
> <form-beans>
> <form-bean name="LoginForm" type="forms.LoginForm"/>
> </form-beans>
> ...
> <action
> path="/Login"
> type="actions.LoginAction"
> name="LoginForm"
> scope="request"
> validate="true"
> input="/login.jsp">
> </action>
>
> The LoginAction class takes care of authentication using the values in
> LoginForm successfully. My question is, if the user request something
> with /secure in it's path, for example, /secure/page1, how do I
> forward to the originally requested page after the user is
> authenticated successfully. Normally I would return an ActionForward
> object that forwards to the requested page, but I'm not sure how to
> figure out what the requested page is from within the LoginAction
> object.

 
Reply With Quote
 
 
 
 
Rajesh Tihari
Guest
Posts: n/a
 
      05-28-2004
You can also try out CAS. It is available at http://www.yale.edu/tp/auth/
It is an excellent Open Source Single Sign On product.

Cheers
Rajesh

(Antoine Diot) wrote in message news:<. com>...
> Hello All. Thanks in advance for your help.
>
> I'm trying to implement Application controlled security in conjunction
> with the <security-constraint> option in web.xml. I'm using Struts
> 1.1 and Tomcat 5.0.24.Here's what I got.
>
> web.xml:
> <security-constraint>
> <web-resource-collection>
> <web-resource-name>Secure Area</web-resource-name>
> <url-pattern>/secure/*</url-pattern>
> <http-method>DELETE</http-method>
> <http-method>GET</http-method>
> <http-method>POST</http-method>
> <http-method>PUT</http-method>
> </web-resource-collection>
> <auth-constraint>
> <role-name>admin</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>/loginError.jsp</form-error-page>
> </form-login-config>
> </login-config>
>
> struts-config.xml:
> <form-beans>
> <form-bean name="LoginForm" type="forms.LoginForm"/>
> </form-beans>
> ...
> <action
> path="/Login"
> type="actions.LoginAction"
> name="LoginForm"
> scope="request"
> validate="true"
> input="/login.jsp">
> </action>
>
> The LoginAction class takes care of authentication using the values in
> LoginForm successfully. My question is, if the user request something
> with /secure in it's path, for example, /secure/page1, how do I
> forward to the originally requested page after the user is
> authenticated successfully. Normally I would return an ActionForward
> object that forwards to the requested page, but I'm not sure how to
> figure out what the requested page is from within the LoginAction
> object.

 
Reply With Quote
 
pravda
Guest
Posts: n/a
 
      06-05-2004
There is an alternative to using CAS (which seems promissing). Just
store the url of the requesting page in the session by default.
Define a string property in the Super ActionForm to set the "
frompage" in ever JSP you use (and perhaps the toPage). In this manner
you always keep control on the flow. Your login-action accesses the
form to retrieve the orginal page and forwards either to the login.jsp
or to tthe toPage".
Regards,
herman ( who's incredible drunk).


On 27 May 2004 16:09:53 -0700, (Antoine Diot) wrote:

>Hello All. Thanks in advance for your help.
>
>I'm trying to implement Application controlled security in conjunction
>with the <security-constraint> option in web.xml. I'm using Struts
>1.1 and Tomcat 5.0.24.Here's what I got.
>
>web.xml:
> <security-constraint>
> <web-resource-collection>
> <web-resource-name>Secure Area</web-resource-name>
> <url-pattern>/secure/*</url-pattern>
> <http-method>DELETE</http-method>
> <http-method>GET</http-method>
> <http-method>POST</http-method>
> <http-method>PUT</http-method>
> </web-resource-collection>
> <auth-constraint>
> <role-name>admin</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>/loginError.jsp</form-error-page>
> </form-login-config>
> </login-config>
>
>struts-config.xml:
> <form-beans>
> <form-bean name="LoginForm" type="forms.LoginForm"/>
> </form-beans>
> ...
> <action
> path="/Login"
> type="actions.LoginAction"
> name="LoginForm"
> scope="request"
> validate="true"
> input="/login.jsp">
> </action>
>
>The LoginAction class takes care of authentication using the values in
>LoginForm successfully. My question is, if the user request something
>with /secure in it's path, for example, /secure/page1, how do I
>forward to the originally requested page after the user is
>authenticated successfully. Normally I would return an ActionForward
>object that forwards to the requested page, but I'm not sure how to
>figure out what the requested page is from within the LoginAction
>object.


 
Reply With Quote
 
pravda
Guest
Posts: n/a
 
      06-05-2004
On 27 May 2004 16:09:53 -0700, (Antoine Diot) wrote:

>Hello All. Thanks in advance for your help.
>
>I'm trying to implement Application controlled security in conjunction
>with the <security-constraint> option in web.xml. I'm using Struts
>1.1 and Tomcat 5.0.24.Here's what I got.
>
>web.xml:
> <security-constraint>
> <web-resource-collection>
> <web-resource-name>Secure Area</web-resource-name>
> <url-pattern>/secure/*</url-pattern>
> <http-method>DELETE</http-method>
> <http-method>GET</http-method>
> <http-method>POST</http-method>
> <http-method>PUT</http-method>
> </web-resource-collection>
> <auth-constraint>
> <role-name>admin</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>/loginError.jsp</form-error-page>
> </form-login-config>
> </login-config>
>
>struts-config.xml:
> <form-beans>
> <form-bean name="LoginForm" type="forms.LoginForm"/>
> </form-beans>
> ...
> <action
> path="/Login"
> type="actions.LoginAction"
> name="LoginForm"
> scope="request"
> validate="true"
> input="/login.jsp">
> </action>
>
>The LoginAction class takes care of authentication using the values in
>LoginForm successfully. My question is, if the user request something
>with /secure in it's path, for example, /secure/page1, how do I
>forward to the originally requested page after the user is
>authenticated successfully. Normally I would return an ActionForward
>object that forwards to the requested page, but I'm not sure how to
>figure out what the requested page is from within the LoginAction
>object.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic contenet controlled by win32 application. Gil ASP .Net 3 07-10-2006 03:43 PM
Tomcat Struts ClassCastException - looks like a Tomcat bug Stewart Java 3 08-18-2005 10:24 AM
Tomcat 5.028 Struts problem - struts-config.xml does not start with a "/" character Aleksandar Matijaca Java 2 09-19-2004 03:52 PM
Struts: jsp cannot display message controlled by action PC Leung Java 10 07-22-2004 09:43 AM
Tomcat/Struts application deployment error Mike Java 1 07-30-2003 05:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57