aspose file tools*
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
Author

java network authorization

Nazim Akperov
Greenhorn

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?
"MyAuthenticator.class"
......
class MyAuthenticator extends Authenticator
{
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication ("user","password".toCharArray());
}
}
.....
Invoking method in main class
.................
java.net.Authenticator.setDefault (new MyAuthenticator ());
URL curl=new URL("password protected URL");
.................
Cindy Glass
"The Hood"
Sheriff

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


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
 
subject: java network authorization