Meaningless Drivel is fun!*
The moose likes Security and the fly likes Programatically call Java 2 secured page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Programatically call Java 2 secured page" Watch "Programatically call Java 2 secured page" New topic
Author

Programatically call Java 2 secured page

Adam Kreiss
Ranch Hand

Joined: Sep 12, 2005
Posts: 35
Hey,

Not positive this is the right forum but here it goes.

Does anyone have a good tutorial for accessing a web page via Java code where the page is secured with standard Java 2 security by the web server? Ideally I'd like to use Apache HttpClient to do so but haven't been able to find any good examples.

Thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41181
    
  45
What do you mean by "secured with standard Java 2 security"? The only security that would be applicable to a web app would be to use HTTP Authentication (and possibly using HTTPS, which doesn't have much to do with Java). HttpClient can handle HTTP Authentication.


Ping & DNS - my free Android networking tools app
Adam Kreiss
Ranch Hand

Joined: Sep 12, 2005
Posts: 35
Sorry for the confusion.

I'm thinking about the j_username/j_password user auth functionality that most web servers offer. How would I go about passing the auth values in a request to the server?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41181
    
  45
Ah, that's called FORM authentication, and is a little harder to automate. The code would access some URL that is protected, which would then cause the login page to be shown. Into that page (or rather, the HTML form in it) would the code enter appropriate values for j_username and j_password, and then submit it. If everything went OK, the server would then respond with the page that was originally requested.
This discussion may help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Programatically call Java 2 secured page
 
Similar Threads
Form Authentication not working
Looking for job change (2 years exp, Java/J2EE)
Methods to secure web application
applet can't upload file through orion user manager
Java Client for a WS-Secure Jax-WS Web Service