File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes java network authorization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "java network authorization " Watch "java network authorization " New topic

java network authorization

Nazim Akperov

Joined: Nov 03, 2002
Posts: 1
Hi all
Imagine situation:
a. You need to access a password protected page (HTTP authorization)
b. You are behind a corporate firewall wich asks you for another
user/password credentials
So you have to pass proxy authorization first and page authorization second.
It's ok for me to pass separately 1 or second stage using simple
"authenticator" class but how to combine them?
As a sample i pass you code which works fine only for one step of
authorization. Question is how to pass 2 consequent authorization requests?
class MyAuthenticator extends Authenticator
protected PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication ("user","password".toCharArray());
Invoking method in main class
................. (new MyAuthenticator ());
URL curl=new URL("password protected URL");
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Moving to Security.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: java network authorization
It's not a secret anymore!