Results 1 to 1 of 1
  1. #1
    hemaljoes is offline Member
    Join Date
    Jan 2011
    Rep Power

    Default 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 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("");
    URLConnection uRLConnection = url.openConnection();
    String authorization ="hemaljoes:password";
    uRLConnection.setRequestProperty("Authorization", "Basic " + authorization);

    OutputStream outputStream = uRLConnection.getOutputStream();

    InputStream in = uRLConnection.getInputStream();
    InputStreamReader inReader = new InputStreamReader(in);
    BufferedReader reader = new BufferedReader(inReader);

    String newLine = null;
    while ((newLine = reader.readLine()) != null)

    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 07:42 PM.

Similar Threads

  1. How to authenticate code with no internet connect.
    By beardawg in forum Java Applets
    Replies: 1
    Last Post: 04-14-2010, 08:31 PM
  2. Replies: 0
    Last Post: 04-13-2010, 09:16 PM
  3. Replies: 4
    Last Post: 10-07-2009, 10:14 AM
  4. Error: JCE cannot authenticate the provider BC
    By mariabg in forum Java Servlet
    Replies: 0
    Last Post: 02-26-2009, 12:55 PM
  5. Connecting to a Website with the default browser
    By Riftwalker in forum Java Applets
    Replies: 4
    Last Post: 12-04-2007, 05:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts