1 6 package fr.jayasoft.ivy.url; 7 8 import java.net.Authenticator ; 9 import java.net.PasswordAuthentication ; 10 11 import fr.jayasoft.ivy.util.Credentials; 12 import fr.jayasoft.ivy.util.Message; 13 14 19 public final class IvyAuthenticator extends Authenticator { 20 21 22 25 public final static IvyAuthenticator INSTANCE = new IvyAuthenticator(); 26 27 31 private IvyAuthenticator() { 32 Authenticator.setDefault(this); 34 } 35 36 38 40 protected PasswordAuthentication getPasswordAuthentication() { 41 Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(), getRequestingHost()); 42 Message.debug("authentication: k='"+Credentials.buildKey(getRequestingPrompt(), getRequestingHost())+"' c='" + c + "'"); 43 return c != null ? new PasswordAuthentication (c.getUserName(), c.getPasswd().toCharArray()) : null; 44 } 45 46 47 } 48 | Popular Tags |