public Executor auth(final AuthScope authScope, final Credentials creds) { if (this.credentialsStore == null) { this.credentialsStore = new BasicCredentialsProvider(); } this.credentialsStore.setCredentials(authScope, creds); return this; }
public Executor auth(final AuthScope authScope, final Credentials creds) { if (this.credentialsStore == null) { this.credentialsStore = new BasicCredentialsProvider(); } this.credentialsStore.setCredentials(authScope, creds); return this; }
public static void extractFromAuthority( final String scheme, final URIAuthority authority, final CredentialsStore credentialsStore) { Args.notNull(credentialsStore, "Credentials store"); if (authority == null) { return; } final String userinfo = authority.getUserInfo(); if (userinfo == null) { return; } final int atColon = userinfo.indexOf(':'); final String userName; final char[] password; if (atColon >= 0) { userName = userinfo.substring(0, atColon); password = userinfo.substring(atColon + 1).toCharArray(); } else { userName = userinfo.substring(0, atColon); password = null; } credentialsStore.setCredentials( new AuthScope(scheme, authority.getHostName(), authority.getPort(), null, AuthSchemes.BASIC.ident), new UsernamePasswordCredentials(userName, password)); }