本文整理匯總了Java中org.apache.http.client.config.AuthSchemes.NTLM屬性的典型用法代碼示例。如果您正苦於以下問題:Java AuthSchemes.NTLM屬性的具體用法?Java AuthSchemes.NTLM怎麽用?Java AuthSchemes.NTLM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.http.client.config.AuthSchemes
的用法示例。
在下文中一共展示了AuthSchemes.NTLM屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: getCredentials
@Override
public Credentials getCredentials(AuthScope authscope)
{
Credentials retCredentials = null;
String host = authscope.getHost();
int port = authscope.getPort();
if (host != AuthScope.ANY_HOST && port != AuthScope.ANY_PORT)
{
String scheme = authscope.getScheme().toUpperCase();
switch (scheme)
{
case "BASIC":
case "DIGEST":
retCredentials = credentials;
break;
case AuthSchemes.NTLM:
retCredentials = ntCredentials;
break;
default:
break;
}
}
if (retCredentials == null)
{
retCredentials = super.getCredentials(authscope);
}
return retCredentials;
}
示例3: 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());
}
示例4: create
@Override
public AuthScheme create(final HttpContext context) {
return new WindowsNegotiateScheme(AuthSchemes.NTLM, servicePrincipalName);
}