當前位置: 首頁>>代碼示例>>Java>>正文


Java AuthSchemes.BASIC屬性代碼示例

本文整理匯總了Java中org.apache.http.client.config.AuthSchemes.BASIC屬性的典型用法代碼示例。如果您正苦於以下問題:Java AuthSchemes.BASIC屬性的具體用法?Java AuthSchemes.BASIC怎麽用?Java AuthSchemes.BASIC使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.http.client.config.AuthSchemes的用法示例。


在下文中一共展示了AuthSchemes.BASIC屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkUserCredentials

public static void checkUserCredentials(String username, String password, AuthScheme authScheme) throws NoSuchFieldException,
    IllegalAccessException
{
  CredentialsProvider provider = getCredentialsProvider();
  String httpScheme = AuthScope.ANY_SCHEME;
  if (authScheme == AuthScheme.BASIC) {
    httpScheme = AuthSchemes.BASIC;
  } else if (authScheme == AuthScheme.DIGEST) {
    httpScheme = AuthSchemes.DIGEST;
  }
  AuthScope authScope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, httpScheme);
  Credentials credentials = provider.getCredentials(authScope);
  Assert.assertNotNull("Credentials", credentials);
  Assert.assertTrue("Credentials type is user", UsernamePasswordCredentials.class.isAssignableFrom(credentials.getClass()));
  UsernamePasswordCredentials pwdCredentials = (UsernamePasswordCredentials)credentials;
  Assert.assertEquals("Username", username, pwdCredentials.getUserName());
  Assert.assertEquals("Password", password, pwdCredentials.getPassword());
}
 
開發者ID:apache,項目名稱:apex-core,代碼行數:18,代碼來源:WebServicesClientTest.java

示例2: getAuthScheme

private String getAuthScheme(Authentication authentication) {
    if (authentication instanceof BasicAuthentication) {
        return AuthSchemes.BASIC;
    } else if (authentication instanceof DigestAuthentication) {
        return AuthSchemes.DIGEST;
    } else if (authentication instanceof AllSchemesAuthentication) {
        return AuthScope.ANY_SCHEME;
    } else {
        throw new IllegalArgumentException(String.format("Authentication scheme of '%s' is not supported.", authentication.getClass().getSimpleName()));
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:11,代碼來源:HttpClientConfigurer.java

示例3: toApacheAuthenticationScheme

/**
 * Convert the customer-facing authentication method into an apache-specific authentication method.
 */
private String toApacheAuthenticationScheme(ProxyAuthenticationMethod authenticationMethod) {
    if (authenticationMethod == null) {
        throw new IllegalStateException("The configured proxy authentication methods must not be null.");
    }

    switch (authenticationMethod) {
        case NTLM: return AuthSchemes.NTLM;
        case BASIC: return AuthSchemes.BASIC;
        case DIGEST: return AuthSchemes.DIGEST;
        case SPNEGO: return AuthSchemes.SPNEGO;
        case KERBEROS: return AuthSchemes.KERBEROS;
        default: throw new IllegalStateException("Unknown authentication scheme: " + authenticationMethod);
    }
}
 
開發者ID:IBM,項目名稱:ibm-cos-sdk-java,代碼行數:17,代碼來源:ApacheHttpRequestFactory.java

示例4: getAuthenticationScheme

private String getAuthenticationScheme() {
	if (getConfiguration().getWinRmAuthenticationScheme() == null) {
		return AuthSchemes.NTLM;
	}
	if (AdLdapConfiguration.WINDOWS_AUTHENTICATION_SCHEME_BASIC.equals(getConfiguration().getWinRmAuthenticationScheme())) {
		return AuthSchemes.BASIC;
	}
	if (AdLdapConfiguration.WINDOWS_AUTHENTICATION_SCHEME_NTLM.equals(getConfiguration().getWinRmAuthenticationScheme())) {
		return AuthSchemes.NTLM;
	}
	if (AdLdapConfiguration.WINDOWS_AUTHENTICATION_SCHEME_CREDSSP.equals(getConfiguration().getWinRmAuthenticationScheme())) {
		return AuthSchemes.CREDSSP;
	}
	throw new ConfigurationException("Unknown authentication scheme: "+getConfiguration().getWinRmAuthenticationScheme());
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:15,代碼來源:AdLdapConnector.java


注:本文中的org.apache.http.client.config.AuthSchemes.BASIC屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。