当前位置: 首页>>代码示例>>Java>>正文


Java AuthState.isValid方法代码示例

本文整理汇总了Java中org.apache.http.auth.AuthState.isValid方法的典型用法代码示例。如果您正苦于以下问题:Java AuthState.isValid方法的具体用法?Java AuthState.isValid怎么用?Java AuthState.isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.auth.AuthState的用法示例。


在下文中一共展示了AuthState.isValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateAuthState

import org.apache.http.auth.AuthState; //导入方法依赖的package包/类
private void updateAuthState(
    final AuthState authState,
    final HttpHost host,
    final CredentialsProvider credsProvider) {

  if (!authState.isValid()) {
    return;
  }

  String hostname = host.getHostName();
  int port = host.getPort();
  if (port < 0) {
    Scheme scheme = connManager.getSchemeRegistry().getScheme(host);
    port = scheme.getDefaultPort();
  }

  AuthScheme authScheme = authState.getAuthScheme();
  AuthScope authScope = new AuthScope(
      hostname,
      port,
      authScheme.getRealm(),
      authScheme.getSchemeName());

  if (this.log.isDebugEnabled()) {
    this.log.debug("Authentication scope: " + authScope);
  }
  Credentials creds = authState.getCredentials();
  if (creds == null) {
    creds = credsProvider.getCredentials(authScope);
    if (this.log.isDebugEnabled()) {
      if (creds != null) {
        this.log.debug("Found credentials");
      } else {
        this.log.debug("Credentials not found");
      }
    }
  } else {
    if (authScheme.isComplete()) {
      this.log.debug("Authentication failed");
      creds = null;
    }
  }
  authState.setAuthScope(authScope);
  authState.setCredentials(creds);
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:46,代码来源:DefaultRequestDirector.java

示例2: updateAuthState

import org.apache.http.auth.AuthState; //导入方法依赖的package包/类
private void updateAuthState(
        final AuthState authState, 
        final HttpHost host,
        final CredentialsProvider credsProvider) {
    
    if (!authState.isValid()) {
        return;
    }
    
    String hostname = host.getHostName();
    int port = host.getPort();
    if (port < 0) {
        Scheme scheme = connManager.getSchemeRegistry().getScheme(host);
        port = scheme.getDefaultPort();
    }
    
    AuthScheme authScheme = authState.getAuthScheme();
    AuthScope authScope = new AuthScope(
            hostname,
            port,
            authScheme.getRealm(), 
            authScheme.getSchemeName());  
    
    if (this.log.isDebugEnabled()) {
        this.log.debug("Authentication scope: " + authScope);
    }
    Credentials creds = authState.getCredentials();
    if (creds == null) {
        creds = credsProvider.getCredentials(authScope);
        if (this.log.isDebugEnabled()) {
            if (creds != null) {
                this.log.debug("Found credentials");
            } else {
                this.log.debug("Credentials not found");
            }
        }
    } else {
        if (authScheme.isComplete()) {
            this.log.debug("Authentication failed");
            creds = null;
        }
    }
    authState.setAuthScope(authScope);
    authState.setCredentials(creds);
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:46,代码来源:DefaultRequestDirector.java

示例3: updateAuthState

import org.apache.http.auth.AuthState; //导入方法依赖的package包/类
private void updateAuthState(
        final AuthState authState,
        final HttpHost host,
        final CredentialsProvider credsProvider) {

    if (!authState.isValid()) {
        return;
    }

    String hostname = host.getHostName();
    int port = host.getPort();
    if (port < 0) {
        Scheme scheme = connManager.getSchemeRegistry().getScheme(host);
        port = scheme.getDefaultPort();
    }

    AuthScheme authScheme = authState.getAuthScheme();
    AuthScope authScope = new AuthScope(
            hostname,
            port,
            authScheme.getRealm(),
            authScheme.getSchemeName());

    if (DEBUG) {
    	Logger.debug("Authentication scope: {}", authScope);
    }
    Credentials creds = authState.getCredentials();
    if (creds == null) {
        creds = credsProvider.getCredentials(authScope);
        if (DEBUG) {
            if (creds != null) {
            	Logger.debug("Found credentials");
            } else {
            	Logger.debug("Credentials not found");
            }
        }
    } else {
        if (authScheme.isComplete()) {
        	if (DEBUG) {
        		Logger.debug("Authentication failed");
        	}
            creds = null;
        }
    }
    authState.setAuthScope(authScope);
    authState.setCredentials(creds);
}
 
开发者ID:cattong,项目名称:YiBo,代码行数:48,代码来源:LibRequestDirector.java

示例4: updateAuthState

import org.apache.http.auth.AuthState; //导入方法依赖的package包/类
private void updateAuthState(
        final AuthState authState,
        final HttpHost host,
        final CredentialsProvider credsProvider) {

    if (!authState.isValid()) {
        return;
    }

    String hostname = host.getHostName();
    int port = host.getPort();
    if (port < 0) {
        Scheme scheme = connManager.getSchemeRegistry().getScheme(host);
        port = scheme.getDefaultPort();
    }

    AuthScheme authScheme = authState.getAuthScheme();
    AuthScope authScope = new AuthScope(
            hostname,
            port,
            authScheme.getRealm(),
            authScheme.getSchemeName());

    if (Constants.DEBUG) {
    	logger.debug("Authentication scope: {}", authScope);
    }
    Credentials creds = authState.getCredentials();
    if (creds == null) {
        creds = credsProvider.getCredentials(authScope);
        if (Constants.DEBUG) {
            if (creds != null) {
            	logger.debug("Found credentials");
            } else {
            	logger.debug("Credentials not found");
            }
        }
    } else {
        if (authScheme.isComplete()) {
        	if (Constants.DEBUG) {
        		logger.debug("Authentication failed");
        	}
            creds = null;
        }
    }
    authState.setAuthScope(authScope);
    authState.setCredentials(creds);
}
 
开发者ID:yibome,项目名称:yibo-library,代码行数:48,代码来源:YiBoRequestDirector.java


注:本文中的org.apache.http.auth.AuthState.isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。