• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java network authorization

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
.................
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Security.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic