Results 1 to 1 of 1
- 01-29-2011, 06:20 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 1
- Rep Power
- 0
Authenticate for a website without using a browser.
Hi everyone,
I need to create a java class which can do the following requirement.
- When the openid and the password is given it should create and HttpRequest and send to the https://www.myopenid.com/signin_password page and get the authResponse which has the openid token.
- I need to do accomplish the above task without using a browser.
I tried the following code. but it just return the html of the sign_in page.
URL url = new URL("https://www.myopenid.com/signin_password");
URLConnection uRLConnection = url.openConnection();
uRLConnection.setAllowUserInteraction(true);
uRLConnection.setDoInput(true);
uRLConnection.setDoOutput(true);
String authorization ="hemaljoes:password";
uRLConnection.setRequestProperty("Authorization", "Basic " + authorization);
uRLConnection.connect();
OutputStream outputStream = uRLConnection.getOutputStream();
outputStream.flush();
InputStream in = uRLConnection.getInputStream();
InputStreamReader inReader = new InputStreamReader(in);
BufferedReader reader = new BufferedReader(inReader);
String newLine = null;
while ((newLine = reader.readLine()) != null)
System.out.println(newLine);
reader.close();
String headerName=null;
for (int i=1; (headerName = uRLConnection.getHeaderFieldKey(i))!=null; i++) {
System.out.println(uRLConnection.getHeaderFieldKey (i));
System.out.println(uRLConnection.getHeaderField(i) );
}
Can anyone help me please.
Thanks in advanced.Last edited by hemaljoes; 01-29-2011 at 06:42 PM.
Similar Threads
-
How to authenticate code with no internet connect.
By beardawg in forum Java AppletsReplies: 1Last Post: 04-14-2010, 07:31 PM -
How to authenticate code with no internet connect.
By beardawg in forum JavaFXReplies: 0Last Post: 04-13-2010, 08:16 PM -
[HELP]JButton opening a browser and opening a website[HELP]
By Learnin in forum AWT / SwingReplies: 4Last Post: 10-07-2009, 09:14 AM -
Error: JCE cannot authenticate the provider BC
By mariabg in forum Java ServletReplies: 0Last Post: 02-26-2009, 11:55 AM -
Connecting to a Website with the default browser
By Riftwalker in forum Java AppletsReplies: 4Last Post: 12-04-2007, 04:57 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks