本文整理汇总了Java中org.apache.http.auth.ChallengeState类的典型用法代码示例。如果您正苦于以下问题:Java ChallengeState类的具体用法?Java ChallengeState怎么用?Java ChallengeState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChallengeState类属于org.apache.http.auth包,在下文中一共展示了ChallengeState类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertHttpClientContext
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
private HttpClientContext convertHttpClientContext(Request request, Site site, Proxy proxy) {
HttpClientContext httpContext = new HttpClientContext();
if (proxy != null && proxy.getUsername() != null) {
AuthState authState = new AuthState();
authState.update(new BasicScheme(ChallengeState.PROXY), new UsernamePasswordCredentials(proxy.getUsername(), proxy.getPassword()));
httpContext.setAttribute(HttpClientContext.PROXY_AUTH_STATE, authState);
}
if (request.getCookies() != null && !request.getCookies().isEmpty()) {
CookieStore cookieStore = new BasicCookieStore();
for (Map.Entry<String, String> cookieEntry : request.getCookies().entrySet()) {
BasicClientCookie cookie1 = new BasicClientCookie(cookieEntry.getKey(), cookieEntry.getValue());
cookie1.setDomain(UrlUtils.removePort(UrlUtils.getDomain(request.getUrl())));
cookieStore.addCookie(cookie1);
}
httpContext.setCookieStore(cookieStore);
}
return httpContext;
}
开发者ID:code4craft,项目名称:webmagic,代码行数:19,代码来源:HttpUriRequestConverter.java
示例2: readObject
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
this.credentialsCharset = CharsetUtils.get(in.readUTF());
if (this.credentialsCharset == null) {
this.credentialsCharset = Consts.ASCII;
}
this.challengeState = (ChallengeState) in.readObject();
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:10,代码来源:RFC2617Scheme.java
示例3: process
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
@Override
public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
HttpClientContext clientContext = HttpClientContext.adapt(context);
AuthState proxyAuthState = clientContext.getProxyAuthState();
// If there's no auth scheme available yet, try to initialize it preemptively
if (proxyAuthState.getAuthScheme() == null) {
CredentialsProvider credsProvider = clientContext.getCredentialsProvider();
RouteInfo route = clientContext.getHttpRoute();
if (route == null) {
log.debug("No route found for {}", clientContext.getTargetHost());
return;
}
HttpHost proxyHost = route.getProxyHost();
if (proxyHost == null) {
log.warn("No proxy host found in route {} for host {}", route, clientContext.getTargetHost());
return;
}
Credentials creds = credsProvider.getCredentials(
new AuthScope(proxyHost.getHostName(), proxyHost.getPort()));
if (creds == null) {
log.info("No credentials found for proxy: " + proxyHost);
return;
}
proxyAuthState.update(new BasicScheme(ChallengeState.PROXY), creds);
}
}
开发者ID:alancnet,项目名称:artifactory,代码行数:30,代码来源:ProxyPreemptiveAuthInterceptor.java
示例4: RFC2617SchemeHC4
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>RFC2617Scheme</tt> with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public RFC2617SchemeHC4(final ChallengeState challengeState) {
super(challengeState);
this.params = new HashMap<String, String>();
this.credentialsCharset = Consts.ASCII;
}
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:15,代码来源:RFC2617SchemeHC4.java
示例5: RFC2617Scheme
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of {@code RFC2617Scheme} with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public RFC2617Scheme(final ChallengeState challengeState) {
super(challengeState);
this.params = new HashMap<String, String>();
this.credentialsCharset = Consts.ASCII;
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:15,代码来源:RFC2617Scheme.java
示例6: RFC2617Scheme
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>RFC2617Scheme</tt> with the given challenge
* state.
*
* @since 4.2
*/
public RFC2617Scheme(final ChallengeState challengeState) {
super(challengeState);
this.params = new HashMap<String, String>();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:RFC2617Scheme.java
示例7: DigestScheme
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>DigestScheme</tt> with the given challenge
* state.
*
* @since 4.2
*/
public DigestScheme(final ChallengeState challengeState) {
super(challengeState);
this.complete = false;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:DigestScheme.java
示例8: BasicScheme
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>BasicScheme</tt> with the given challenge
* state.
*
* @since 4.2
*/
public BasicScheme(final ChallengeState challengeState) {
super(challengeState);
this.complete = false;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:BasicScheme.java
示例9: AuthSchemeBase
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>AuthSchemeBase</tt> with the given challenge
* state.
*
* @since 4.2
*/
public AuthSchemeBase(final ChallengeState challengeState) {
super();
this.challengeState = challengeState;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:AuthSchemeBase.java
示例10: isProxy
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Returns <code>true</code> if authenticating against a proxy, <code>false</code>
* otherwise.
*/
public boolean isProxy() {
return this.challengeState != null && this.challengeState == ChallengeState.PROXY;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AuthSchemeBase.java
示例11: getChallengeState
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Returns {@link ChallengeState} value or <code>null</code> if unchallenged.
*
* @since 4.2
*/
public ChallengeState getChallengeState() {
return this.challengeState;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:AuthSchemeBase.java
示例12: BasicSchemeHC4
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>BasicScheme</tt> with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public BasicSchemeHC4(final ChallengeState challengeState) {
super(challengeState);
}
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:13,代码来源:BasicSchemeHC4.java
示例13: DigestSchemeHC4
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>DigestScheme</tt> with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public DigestSchemeHC4(final ChallengeState challengeState) {
super(challengeState);
}
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:13,代码来源:DigestSchemeHC4.java
示例14: AuthSchemeBaseHC4
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of <tt>AuthSchemeBase</tt> with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public AuthSchemeBaseHC4(final ChallengeState challengeState) {
super();
this.challengeState = challengeState;
}
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:14,代码来源:AuthSchemeBaseHC4.java
示例15: DigestScheme
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of {@code DigestScheme} with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public DigestScheme(final ChallengeState challengeState) {
super(challengeState);
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:13,代码来源:DigestScheme.java
示例16: BasicScheme
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of {@code BasicScheme} with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public BasicScheme(final ChallengeState challengeState) {
super(challengeState);
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:13,代码来源:BasicScheme.java
示例17: AuthSchemeBase
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Creates an instance of {@code AuthSchemeBase} with the given challenge
* state.
*
* @since 4.2
*
* @deprecated (4.3) do not use.
*/
@Deprecated
public AuthSchemeBase(final ChallengeState challengeState) {
super();
this.challengeState = challengeState;
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:14,代码来源:AuthSchemeBase.java
示例18: isProxy
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Returns {@code true} if authenticating against a proxy, {@code false}
* otherwise.
*/
public boolean isProxy() {
return this.challengeState != null && this.challengeState == ChallengeState.PROXY;
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:8,代码来源:AuthSchemeBase.java
示例19: getChallengeState
import org.apache.http.auth.ChallengeState; //导入依赖的package包/类
/**
* Returns {@link ChallengeState} value or {@code null} if unchallenged.
*
* @since 4.2
*/
public ChallengeState getChallengeState() {
return this.challengeState;
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:9,代码来源:AuthSchemeBase.java
注:本文中的org.apache.http.auth.ChallengeState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论