Eric Ases

Greenhorn
+ Follow
since Nov 17, 2010
Eric likes ...
Eclipse IDE Tomcat Server Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eric Ases

Thanks, Tim. Apparently I was unknowingly taking advantage of some undocumented behavior in Tomcat 6.

I have a follow-up question now... is there any way to access the Request object from the custom Realm? Basically, what I am trying to do is check if the user has a cookie set from a previous session, then do special processing (and "remember me" logic) before attempting the normal container authentication. I've tried using a filter or listener in my webapp, but Tomcat's authentication steps in before the request gets that far. Is there any hook before Tomcat's authentication happens?

Perhaps I'm not searching for the right thing, but I haven't been able to find any information on implementing "remember me" cookies in conjunction with Tomcat's form authentication. Is it just not possible without re-implementing the authentication mechanism yourself? This has to be a common issue, so I'm not sure what I'm missing.
12 years ago
I have made a custom authenticator to use with tomcat's container-managed security which provides some extra features on top of the basic FormAuthenticator (including some cookie handling, etc). In previous versions of Tomcat (6.0.29) I was able to declare this in the <Context> in server.xml and it would be triggered when a request was made before trying to perform the database lookup. I have recently upgraded to Tomcat 7.0.19, but this Valve seems to always get bypassed. I have searched and could not find an explanation of anything changing with this.

The entry for this app in my server.xml is:


where MyCustomAuthenticator is my custom authenticator which extends FormAuthenticator. My web.xml is configured such that the form authentication does happen correctly, but the issue is the Valve isn't used first.

Am I doing something wrong here, or is there a new way to handle this in Tomcat 7?
12 years ago
I am implementing container-managed authentication for Tomcat 6. I am using a JDBCRealm, and so needed to put a mysql driver in <catalina home>\lib. This mysql-connector jar is version 5. However, one of my web apps is stuck using an older version of mysql-connector, which is in WEB-INF\lib for that web-app.

The problem I'm seeing now is that occasionally, Tomcat seems to choose one version of the mysql jar over the other, causing this web-app to break when it tries using the newer mysql jar (there are a variety of incompatibilities with this newer version that cannot be fixed at this time), OR the custom Authenticator will break since it needs the latest mysql jar.

I tried assigning the old server.loader property in Tomcat's catalina.properties file so that the mysql jar dependency for my JDBCRealm is isolated, Tomcat gave errors about not being able to load the Mysql classes. I am not sure, but it looks like the bootstrap loader is what loads the web-apps and their Realms (rather than the server loader), and that needs the mysql jar, which as far as I can tell, requires that everything be in <catalina home>\lib.

Is there any way to load the two different versions of the jar files and keep them separate?
13 years ago
Hello, I have just started with Struts2, and am trying to pass in custom parameters to my app. This includes mostly text strings like the site name, special email addresses, directories, various flags that are used in the app, etc, so that it can be easily changed out. In my current non-Struts system, I have them in an XML file that I read in on startup with a custom file reader. Is there a way to pass in custom information like this in a Struts way?

I have searched around, but all of the examples I've seen relate to Struts-specific parameters that can be setup via struts.xml or other property files. Thanks!
13 years ago