This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Custom Form Authenticatior is not getting executed with tomcat 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Custom Form Authenticatior is not getting executed with tomcat 7" Watch "Custom Form Authenticatior is not getting executed with tomcat 7" New topic
Author

Custom Form Authenticatior is not getting executed with tomcat 7

Amit Singhall
Greenhorn

Joined: Oct 18, 2005
Posts: 4
Hi,

Custom Form Authenticatior is not getting executed with tomcat 7.

I am using the embeded tomcat in my java application.

I am setting the custom realm on engine level
engine.setRealm(realm);
Then I am adding the my custome form authenticator on the context level
StandardContext root = (StandardContext) tomcat.addWebapp(host,"/myApp","/myApp", catalinaHome + "/webapps/myApp");
CustomFormAuthenticator formAuth = new CustomFormAuthenticator ();
formAuth.setDisableProxyCaching( false );
root.addValve(formAuth);

The CustomFormAuthenticator was running in tomcat 5 , but when I upgraded to tomcat 7 , it stopped executing. I have recompiled all the classes with new tomcat libabries. And also I am using Tomcat class instead of Embedded(deprecated in tomcat 7).
Tomcat Server is getting started but the CustomFormAuthenticator is not getting executed.

Here is the snippet from web.xml


<security-constraint>
<display-name>Custom Framework Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Custom Framework Authentication Required Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Custom Role</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login</form-login-page>
<form-error-page>/loginError</form-error-page>
</form-login-config>
</login-config>

<!-- Define the security roles referenced by this web application. -->
<security-role>
<role-name>Custom Role</role-name>
</security-role>

Amit Singhall
Greenhorn

Joined: Oct 18, 2005
Posts: 4
It seems like the SecurityConstraints are not getting picked for the context.

I am getting this message in the log
" No applicable constraints defined"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Custom Form Authenticatior is not getting executed with tomcat 7