File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Using both BASIC and FORM authentication for different sections of same web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using both BASIC and FORM authentication for different sections of same web application" Watch "Using both BASIC and FORM authentication for different sections of same web application" New topic
Author

Using both BASIC and FORM authentication for different sections of same web application

Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
I'm using FORM auth for my web app. However, I need to present a file to Google Earth. GE only accepts BASIC auth. How can I set up my app to do FORM auth for everything and BASIC auth for the GE file? I'm using Tomcat 6.

I tried adding in a second security constraint, but that's not valid. Is there a way to do this?
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
So it's looking like there's not a way to do this other than making another webapp. Is there a good way to share properties, etc between the two?

Or is there a way to keep everything in one app?
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Bai Shen wrote:So it's looking like there's not a way to do this other than making another webapp. Is there a good way to share properties, etc between the two?

Can you set attributes in the "application" scope (using the setAttribute() method on the Servlet Context object)?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2500
    
    8

Can you set attributes in the "application" scope (using the setAttribute() method on the Servlet Context object)?
Use this with care; it can interfere with load balancing and clustering mechanisms.


OCUP UML fundamental and ITIL foundation
youtube channel
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
I ended up just duplicating my database connection code, since that's where I'm storing my properties.

I'm having a problem though, as this setup has increased my number of logons. I'm serving a dynamically generated KML file for use with Google Earth. I currently have my application using FORM auth. This works create for the entire app. However, Google Earth won't recognize it. So I have to use BASIC auth. So I have two web applications.

myApp which servers my application. Then I have kmlApp which serve the two kml files. I use the http request to determine the server port, ip, context, etc and generate a base kml file. That has a refresh link to a kml file which contains my map data.

The problem is that now my user has to log in three times. Once for my web app. Then once for the base kml file as it's hosted on another app. And thirdly from Google Earth as that's a separate request than the one from the browser.

Is there any way to share the session info or anything like that so my users don't have to keep signing in?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using both BASIC and FORM authentication for different sections of same web application