Java 类org.apache.http.auth.AuthSchemeFactory 实例源码

项目:httpsig-java    文件:Http4Util.java   
public static void enableAuth(final AbstractHttpClient client, final Keychain keychain, final KeyId keyId) {
    if (client == null) {
        throw new NullPointerException("client");
    }

    if (keychain == null) {
        throw new NullPointerException("keychain");
    }

    client.getAuthSchemes().register(Constants.SCHEME, new AuthSchemeFactory() {
        public AuthScheme newInstance(HttpParams params) {
            return new Http4SignatureAuthScheme();
        }
    });

    Signer signer = new Signer(keychain, keyId);
    client.getCredentialsProvider().setCredentials(AuthScope.ANY, new SignerCredentials(signer));
    client.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF,
                                    Arrays.asList(Constants.SCHEME));

    HttpClientParams.setAuthenticating(client.getParams(), true);
}
项目:android-authenticator-framework    文件:AnonymousAuthenticationProvider.java   
@Override
public AuthSchemeFactory getPreemptiveAuthSchemeFactory()
{
    // anonymous authentication doesn't support preemptive authentication
    return null;
}
项目:android-authenticator-framework    文件:BasicHttpClientAuthenticationHandler.java   
@Override
public AuthSchemeFactory getPreemptiveAuthSchemeFactory()
{
    return BASIC_SCHEME_FACTORY;
}
项目:android-authenticator-framework    文件:HttpClientAuthenticationHandler.java   
/**
 * Get an AuthSchemeFactory for {@link AuthScheme}s that can be used to authenticate preemptively.
 * 
 * @return An {@link AuthSchemeFactory} or <code>null</code> if this scheme doesn't support preemptive authentication.
 */
public AuthSchemeFactory getPreemptiveAuthSchemeFactory();