1 16 17 package org.apache.axis.utils; 18 19 import org.apache.axis.components.net.TransportClientProperties; 20 import org.apache.axis.components.net.TransportClientPropertiesFactory; 21 22 23 27 public class DefaultAuthenticator extends java.net.Authenticator { 28 private TransportClientProperties tcp = null; 29 30 private String user; 31 private String password; 32 33 public DefaultAuthenticator(String user, String pass) { 34 this.user = user; 35 this.password = pass; 36 } 37 38 protected java.net.PasswordAuthentication getPasswordAuthentication() { 39 if (user == null) { 41 user = getTransportClientProperties().getProxyUser(); 42 } 43 if (password == null) { 44 password = getTransportClientProperties().getProxyPassword(); 45 } 46 return new java.net.PasswordAuthentication (user, password.toCharArray()); 47 } 48 49 private TransportClientProperties getTransportClientProperties() { 50 if (tcp == null) { 51 tcp = TransportClientPropertiesFactory.create("http"); 52 } 53 return tcp; 54 } 55 } 56 | Popular Tags |