org.apache.commons.httpclient.NTCredentials.getDomain()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.apache.commons.httpclient.NTCredentials.getDomain()方法的一些代码示例,展示了NTCredentials.getDomain()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NTCredentials.getDomain()方法的具体详情如下:
包路径:org.apache.commons.httpclient.NTCredentials
类名称:NTCredentials
方法名:getDomain

NTCredentials.getDomain介绍

[英]Retrieves the name to authenticate with.
[中]检索要进行身份验证的名称。

代码示例

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Create a NTLM authorization string for the given
 * challenge and NT credentials.
 *
 * @param challenge The challenge.
 * @param credentials {@link NTCredentials}
 *
 * @return a ntlm authorization string
 * @throws AuthenticationException is thrown if authentication fails
 * 
 * @deprecated Use non-static {@link #authenticate(Credentials, HttpMethod)}
 */
public static String authenticate(
 final NTCredentials credentials, final String challenge) 
 throws AuthenticationException {
  LOG.trace("enter NTLMScheme.authenticate(NTCredentials, String)");
  if (credentials == null) {
    throw new IllegalArgumentException("Credentials may not be null");
  }
  
  NTLM ntlm = new NTLM();
  String s = ntlm.getResponseFor(challenge,
  credentials.getUserName(), credentials.getPassword(),
  credentials.getHost(), credentials.getDomain());
  return "NTLM " + s;
}

代码示例来源:origin: commons-httpclient/commons-httpclient

credentials.getPassword(),
  credentials.getHost(), 
  credentials.getDomain());
return "NTLM " + s;

代码示例来源:origin: commons-httpclient/commons-httpclient

response = ntlm.getType1Message(
    ntcredentials.getHost(), 
    ntcredentials.getDomain());
  this.state = TYPE1_MSG_GENERATED;
} else {
    ntcredentials.getPassword(),
    ntcredentials.getHost(), 
    ntcredentials.getDomain(),
    ntlm.parseType2Message(this.ntlmchallenge));
  this.state = TYPE3_MSG_GENERATED;

代码示例来源:origin: mguessan/davmail

/**
 * Enable NTLM authentication on http client
 *
 * @param httpClient HttpClient instance
 */
public static void addNTLM(HttpClient httpClient) {
  // disable preemptive authentication
  httpClient.getParams().setParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, false);
  // register the jcifs based NTLMv2 implementation
  AuthPolicy.registerAuthScheme(AuthPolicy.NTLM, NTLMv2Scheme.class);
  ArrayList<String> authPrefs = new ArrayList<String>();
  authPrefs.add(AuthPolicy.NTLM);
  authPrefs.add(AuthPolicy.DIGEST);
  authPrefs.add(AuthPolicy.BASIC);
  httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
  // make sure NTLM is always active
  needNTLM = true;
  // separate domain from username in credentials
  AuthScope authScope = new AuthScope(null, -1);
  NTCredentials credentials = (NTCredentials) httpClient.getState().getCredentials(authScope);
  if (credentials != null && credentials.getDomain() == null) {
    setCredentials(httpClient, credentials.getUserName(), credentials.getPassword());
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Create a NTLM authorization string for the given
 * challenge and NT credentials.
 *
 * @param challenge The challenge.
 * @param credentials {@link NTCredentials}
 *
 * @return a ntlm authorization string
 * @throws AuthenticationException is thrown if authentication fails
 * 
 * @deprecated Use non-static {@link #authenticate(Credentials, HttpMethod)}
 */
public static String authenticate(
 final NTCredentials credentials, final String challenge) 
 throws AuthenticationException {
  LOG.trace("enter NTLMScheme.authenticate(NTCredentials, String)");
  if (credentials == null) {
    throw new IllegalArgumentException("Credentials may not be null");
  }
  
  NTLM ntlm = new NTLM();
  String s = ntlm.getResponseFor(challenge,
  credentials.getUserName(), credentials.getPassword(),
  credentials.getHost(), credentials.getDomain());
  return "NTLM " + s;
}

代码示例来源:origin: org.apache.commons/httpclient

/**
 * Create a NTLM authorization string for the given
 * challenge and NT credentials.
 *
 * @param challenge The challenge.
 * @param credentials {@link NTCredentials}
 *
 * @return a ntlm authorization string
 * @throws AuthenticationException is thrown if authentication fails
 * 
 * @deprecated Use non-static {@link #authenticate(Credentials, HttpMethod)}
 */
public static String authenticate(
 final NTCredentials credentials, final String challenge) 
 throws AuthenticationException {
  LOG.trace("enter NTLMScheme.authenticate(NTCredentials, String)");
  if (credentials == null) {
    throw new IllegalArgumentException("Credentials may not be null");
  }
  
  NTLM ntlm = new NTLM();
  String s = ntlm.getResponseFor(challenge,
  credentials.getUserName(), credentials.getPassword(),
  credentials.getHost(), credentials.getDomain());
  return "NTLM " + s;
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Create a NTLM authorization string for the given
 * challenge and NT credentials.
 *
 * @param challenge The challenge.
 * @param credentials {@link NTCredentials}
 *
 * @return a ntlm authorization string
 * @throws AuthenticationException is thrown if authentication fails
 * 
 * @deprecated Use non-static {@link #authenticate(Credentials, HttpMethod)}
 */
public static String authenticate(
 final NTCredentials credentials, final String challenge) 
 throws AuthenticationException {
  LOG.trace("enter NTLMScheme.authenticate(NTCredentials, String)");
  if (credentials == null) {
    throw new IllegalArgumentException("Credentials may not be null");
  }
  
  NTLM ntlm = new NTLM();
  String s = ntlm.getResponseFor(challenge,
  credentials.getUserName(), credentials.getPassword(),
  credentials.getHost(), credentials.getDomain());
  return "NTLM " + s;
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Create a NTLM authorization string for the given
 * challenge and NT credentials.
 *
 * @param challenge The challenge.
 * @param credentials {@link NTCredentials}
 *
 * @return a ntlm authorization string
 * @throws AuthenticationException is thrown if authentication fails
 * 
 * @deprecated Use non-static {@link #authenticate(Credentials, HttpMethod)}
 */
public static String authenticate(
 final NTCredentials credentials, final String challenge) 
 throws AuthenticationException {
  LOG.trace("enter NTLMScheme.authenticate(NTCredentials, String)");
  if (credentials == null) {
    throw new IllegalArgumentException("Credentials may not be null");
  }
  
  NTLM ntlm = new NTLM();
  String s = ntlm.getResponseFor(challenge,
  credentials.getUserName(), credentials.getPassword(),
  credentials.getHost(), credentials.getDomain());
  return "NTLM " + s;
}

代码示例来源:origin: org.zaproxy/zap

} else if (this.state == State.CHALLENGE_RECEIVED) {
  response = this.engine.generateType1Msg(
      ntcredentials.getDomain(),
      ntcredentials.getHost());
  this.state = State.MSG_TYPE1_GENERATED;
      ntcredentials.getUserName(),
      ntcredentials.getPassword(),
      ntcredentials.getDomain(),
      ntcredentials.getHost(),
      this.challenge);

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

credentials.getPassword(),
  credentials.getHost(), 
  credentials.getDomain());
return "NTLM " + s;

代码示例来源:origin: mguessan/davmail

NtlmFlags.NTLMSSP_NEGOTIATE_OEM | NtlmFlags.NTLMSSP_NEGOTIATE_UNICODE |
    NtlmFlags.NTLMSSP_NEGOTIATE_56 | NtlmFlags.NTLMSSP_NEGOTIATE_128;
Type1Message type1Message = new Type1Message(flags, ntcredentials.getDomain(), ntcredentials.getHost());
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type1Message.toByteArray()));
this.state = TYPE1_MSG_GENERATED;
    NtlmFlags.NTLMSSP_NEGOTIATE_NTLM | NtlmFlags.NTLMSSP_NEGOTIATE_UNICODE;
Type3Message type3Message = new Type3Message(type2Message, ntcredentials.getPassword(),
    ntcredentials.getDomain(), ntcredentials.getUserName(), ntcredentials.getHost(), flags);
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type3Message.toByteArray()));
this.state = TYPE3_MSG_GENERATED;

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

credentials.getPassword(),
  credentials.getHost(), 
  credentials.getDomain());
return "NTLM " + s;

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

credentials.getPassword(),
  credentials.getHost(), 
  credentials.getDomain());
return "NTLM " + s;

代码示例来源:origin: org.apache.commons/httpclient

credentials.getPassword(),
  credentials.getHost(), 
  credentials.getDomain());
return "NTLM " + s;

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

response = ntlm.getType1Message(
    ntcredentials.getHost(), 
    ntcredentials.getDomain());
  this.state = TYPE1_MSG_GENERATED;
} else {
    ntcredentials.getPassword(),
    ntcredentials.getHost(), 
    ntcredentials.getDomain(),
    ntlm.parseType2Message(this.ntlmchallenge));
  this.state = TYPE3_MSG_GENERATED;

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

response = ntlm.getType1Message(
    ntcredentials.getHost(), 
    ntcredentials.getDomain());
  this.state = TYPE1_MSG_GENERATED;
} else {
    ntcredentials.getPassword(),
    ntcredentials.getHost(), 
    ntcredentials.getDomain(),
    ntlm.parseType2Message(this.ntlmchallenge));
  this.state = TYPE3_MSG_GENERATED;

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

response = ntlm.getType1Message(
    ntcredentials.getHost(), 
    ntcredentials.getDomain());
  this.state = TYPE1_MSG_GENERATED;
} else {
    ntcredentials.getPassword(),
    ntcredentials.getHost(), 
    ntcredentials.getDomain(),
    ntlm.parseType2Message(this.ntlmchallenge));
  this.state = TYPE3_MSG_GENERATED;

代码示例来源:origin: org.apache.commons/httpclient

response = ntlm.getType1Message(
    ntcredentials.getHost(), 
    ntcredentials.getDomain());
  this.state = TYPE1_MSG_GENERATED;
} else {
    ntcredentials.getPassword(),
    ntcredentials.getHost(), 
    ntcredentials.getDomain(),
    ntlm.parseType2Message(this.ntlmchallenge));
  this.state = TYPE3_MSG_GENERATED;

相关文章