AuthScope bestMatch = HTTPAuthUtil.bestmatch(scope, localcreds.keySet()); CredentialsProvider cp = null; if(bestMatch != null) { cp = localcreds.get(bestMatch); } else { bestMatch = HTTPAuthUtil.bestmatch(scope, globalcredfactories.keySet()); if(bestMatch != null) { HTTPProviderFactory factory = globalcredfactories.get(bestMatch);
public Credentials getCredentials(AuthScope scope) { Credentials credentials = this.creds.get(scope); if(credentials == null) { AuthScope bestMatch = HTTPAuthUtil.bestmatch(scope,this.creds.keySet()); if(bestMatch != null) credentials = this.creds.get(bestMatch); } if(credentials != null) return credentials; String up = login(this.dfaltuser, this.dfaltpwd, scope); if(up == null) throw new IllegalStateException(); String[] pieces = up.split("[:]"); UsernamePasswordCredentials upc = null; if(pieces.length == 2) { if(DEBUG) { System.out.println("user= (" + pieces[0] + ")"); System.out.println("password= (" + pieces[1] + ")"); } // Is this really necessary? upc = new UsernamePasswordCredentials(pieces[0], pieces[1]); } else upc = null; return upc; }