Results 1 to 2 of 2
  1. #1
    orlozzorro is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default Ntlm authentication

    Pls, help me, I don`t know how to make ntlm session :mad:
    I use this code:
    Java Code:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.Authenticator;
    import java.net.MalformedURLException;
    import java.net.PasswordAuthentication;
    import java.net.URL;
    public class AuthDemo {
      public static void main(String args[]) throws MalformedURLException,
          IOException {
        String urlString = "http://....";
        String username = "login";
        String password = "password";
        Authenticator.setDefault(new MyAuthenticator(username, password));
        URL url = new URL(urlString);
        InputStream content = (InputStream) url.getContent();
        BufferedReader in = new BufferedReader(new InputStreamReader(content));
        String line;
        while ((line = in.readLine()) != null) {
          System.out.println(line);
        }
        System.out.println("Done.");
        
      
      }
      static class MyAuthenticator extends Authenticator {
        private String username, password;
        public MyAuthenticator(String user, String pass) {
          username = user;
          password = pass;
        }
        protected PasswordAuthentication getPasswordAuthentication() {
          System.out.println("Requesting Host  : " + getRequestingHost());
          System.out.println("Requesting Port  : " + getRequestingPort());
          System.out.println("Requesting Prompt : " + getRequestingPrompt());
          System.out.println("Requesting Protocol: "
              + getRequestingProtocol());
          System.out.println("Requesting Scheme : " + getRequestingScheme());
          System.out.println("Requesting Site  : " + getRequestingSite());
          return new PasswordAuthentication(username, password.toCharArray());
        }
      }
    }
    It works! But i need redirect to next page without disconnect from session.

  2. #2
    orlozzorro is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default

    for my mind, i need to get header cookie from 1st page, and set it in 2 page. Can you tell me , how can i do it?:eek::eek::eek:

Similar Threads

  1. IE not reply type 3 NTLM message
    By seritzo in forum Advanced Java
    Replies: 0
    Last Post: 01-22-2010, 02:40 PM
  2. jsp authentication
    By tascoa in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-13-2009, 05:47 PM
  3. NTLM Authentication; cannot call aspx page from java
    By getstarted in forum Advanced Java
    Replies: 0
    Last Post: 04-14-2009, 06:39 PM
  4. bypass NTLM login
    By ruchsriv in forum Web Frameworks
    Replies: 0
    Last Post: 03-30-2009, 08:23 AM
  5. Problem with NTLM ,data not posting to the server
    By raviprakash in forum JavaServer Faces (JSF)
    Replies: 3
    Last Post: 01-03-2008, 03:33 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
  •