< prev index next >

src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java

Print this page




  96 
  97         hostname = java.security.AccessController.doPrivileged(
  98             new java.security.PrivilegedAction<>() {
  99             public String run() {
 100                 String localhost;
 101                 try {
 102                     localhost = InetAddress.getLocalHost().getHostName();
 103                 } catch (UnknownHostException e) {
 104                      localhost = "localhost";
 105                 }
 106                 return localhost;
 107             }
 108         });
 109     };
 110 
 111     PasswordAuthentication pw;
 112 
 113     Client client;
 114     /**
 115      * Create a NTLMAuthentication:
 116      * Username may be specified as domain<BACKSLASH>username in the application Authenticator.

 117      * If this notation is not used, then the domain will be taken
 118      * from a system property: "http.auth.ntlm.domain".
 119      */
 120     public NTLMAuthentication(boolean isProxy, URL url, PasswordAuthentication pw) {
 121         super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
 122                 AuthScheme.NTLM,
 123                 url,
 124                 "");
 125         init (pw);
 126     }
 127 
 128     private void init (PasswordAuthentication pw) {
 129         String username;
 130         String ntdomain;
 131         char[] password;
 132         this.pw = pw;
 133         String s = pw.getUserName();
 134         int i = s.indexOf ('\\');
 135         if (i == -1) {
 136             username = s;




  96 
  97         hostname = java.security.AccessController.doPrivileged(
  98             new java.security.PrivilegedAction<>() {
  99             public String run() {
 100                 String localhost;
 101                 try {
 102                     localhost = InetAddress.getLocalHost().getHostName();
 103                 } catch (UnknownHostException e) {
 104                      localhost = "localhost";
 105                 }
 106                 return localhost;
 107             }
 108         });
 109     };
 110 
 111     PasswordAuthentication pw;
 112 
 113     Client client;
 114     /**
 115      * Create a NTLMAuthentication:
 116      * Username may be specified as {@literal domain<BACKSLASH>username}
 117      * in the application Authenticator.
 118      * If this notation is not used, then the domain will be taken
 119      * from a system property: "http.auth.ntlm.domain".
 120      */
 121     public NTLMAuthentication(boolean isProxy, URL url, PasswordAuthentication pw) {
 122         super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
 123                 AuthScheme.NTLM,
 124                 url,
 125                 "");
 126         init (pw);
 127     }
 128 
 129     private void init (PasswordAuthentication pw) {
 130         String username;
 131         String ntdomain;
 132         char[] password;
 133         this.pw = pw;
 134         String s = pw.getUserName();
 135         int i = s.indexOf ('\\');
 136         if (i == -1) {
 137             username = s;


< prev index next >