• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java network authorization

 
Nazim Akperov
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Security.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic