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


Java AuthScheme.isComplete方法代碼示例

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


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

示例1: isCachable

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private boolean isCachable(final AuthState authState) {
    AuthScheme authScheme = authState.getAuthScheme();
    if (authScheme == null || !authScheme.isComplete()) {
        return false;
    }
    String schemeName = authScheme.getSchemeName();
    return schemeName.equalsIgnoreCase(AuthPolicy.BASIC) ||
            schemeName.equalsIgnoreCase(AuthPolicy.DIGEST);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:ResponseAuthCache.java

示例2: isCachable

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private boolean isCachable(final AuthScheme authScheme) {
    if (authScheme == null || !authScheme.isComplete()) {
        return false;
    }
    String schemeName = authScheme.getSchemeName();
    return schemeName.equalsIgnoreCase(AuthPolicy.BASIC) ||
            schemeName.equalsIgnoreCase(AuthPolicy.DIGEST);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:AuthenticationStrategyAdaptor.java

示例3: getAuthPrincipal

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private static Principal getAuthPrincipal(final AuthState authState) {
    AuthScheme scheme = authState.getAuthScheme();
    if (scheme != null && scheme.isComplete() && scheme.isConnectionBased()) {
        Credentials creds = authState.getCredentials();
        if (creds != null) {
            return creds.getUserPrincipal();
        }
    }
    return null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:DefaultUserTokenHandler.java

示例4: isCachable

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
protected boolean isCachable(final AuthScheme authScheme) {
    if (authScheme == null || !authScheme.isComplete()) {
        return false;
    }
    String schemeName = authScheme.getSchemeName();
    return schemeName.equalsIgnoreCase(AuthPolicy.BASIC) ||
            schemeName.equalsIgnoreCase(AuthPolicy.DIGEST);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:AuthenticationStrategyImpl.java

示例5: isCachable

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
protected boolean isCachable(final AuthScheme authScheme) {
    if (authScheme == null || !authScheme.isComplete()) {
        return false;
    }
    final String schemeName = authScheme.getSchemeName();
    return schemeName.equalsIgnoreCase(AuthSchemes.BASIC) ||
            schemeName.equalsIgnoreCase(AuthSchemes.DIGEST);
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:9,代碼來源:AuthenticationStrategyImpl.java

示例6: getAuthPrincipal

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private static Principal getAuthPrincipal(final AuthStateHC4 authState) {
    final AuthScheme scheme = authState.getAuthScheme();
    if (scheme != null && scheme.isComplete() && scheme.isConnectionBased()) {
        final Credentials creds = authState.getCredentials();
        if (creds != null) {
            return creds.getUserPrincipal();
        }
    }
    return null;
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:11,代碼來源:DefaultUserTokenHandlerHC4.java

示例7: isCachable

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private boolean isCachable(final AuthState authState) {
    final AuthScheme authScheme = authState.getAuthScheme();
    if (authScheme == null || !authScheme.isComplete()) {
        return false;
    }
    final String schemeName = authScheme.getSchemeName();
    return schemeName.equalsIgnoreCase(AuthPolicy.BASIC) ||
            schemeName.equalsIgnoreCase(AuthPolicy.DIGEST);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:10,代碼來源:ResponseAuthCache.java

示例8: isCachable

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private boolean isCachable(final AuthScheme authScheme) {
    if (authScheme == null || !authScheme.isComplete()) {
        return false;
    }
    final String schemeName = authScheme.getSchemeName();
    return schemeName.equalsIgnoreCase(AuthPolicy.BASIC) ||
            schemeName.equalsIgnoreCase(AuthPolicy.DIGEST);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:9,代碼來源:AuthenticationStrategyAdaptor.java

示例9: getAuthPrincipal

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private static Principal getAuthPrincipal(final AuthState authState) {
    final AuthScheme scheme = authState.getAuthScheme();
    if (scheme != null && scheme.isComplete() && scheme.isConnectionBased()) {
        final Credentials creds = authState.getCredentials();
        if (creds != null) {
            return creds.getUserPrincipal();
        }
    }
    return null;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:11,代碼來源:DefaultUserTokenHandler.java

示例10: getAuthPrincipal

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
private static Principal getAuthPrincipal(final AuthState authState) {
    AuthScheme scheme = authState.getAuthScheme();
    if (scheme != null && scheme.isComplete() && scheme.isConnectionBased()) {
        Credentials creds = authState.getCredentials();
        if (creds != null) {
            return creds.getUserPrincipal(); 
        }
    }
    return null;
}
 
開發者ID:tdopires,項目名稱:cJUnit-mc626,代碼行數:11,代碼來源:DefaultUserTokenHandler.java

示例11: authenticate

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
public boolean authenticate(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthState authState,
        final HttpContext context) {
    try {
        if (this.log.isDebugEnabled()) {
            this.log.debug(host.toHostString() + " requested authentication");
        }
        Map<String, Header> challenges = authStrategy.getChallenges(host, response, context);
        if (challenges.isEmpty()) {
            this.log.debug("Response contains no authentication challenges");
            return false;
        }

        AuthScheme authScheme = authState.getAuthScheme();
        switch (authState.getState()) {
        case FAILURE:
            return false;
        case SUCCESS:
            authState.reset();
            break;
        case CHALLENGED:
        case HANDSHAKE:
            if (authScheme == null) {
                this.log.debug("Auth scheme is null");
                authStrategy.authFailed(host, null, context);
                authState.reset();
                authState.setState(AuthProtocolState.FAILURE);
                return false;
            }
        case UNCHALLENGED:
            if (authScheme != null) {
                String id = authScheme.getSchemeName();
                Header challenge = challenges.get(id.toLowerCase(Locale.US));
                if (challenge != null) {
                    this.log.debug("Authorization challenge processed");
                    authScheme.processChallenge(challenge);
                    if (authScheme.isComplete()) {
                        this.log.debug("Authentication failed");
                        authStrategy.authFailed(host, authState.getAuthScheme(), context);
                        authState.reset();
                        authState.setState(AuthProtocolState.FAILURE);
                        return false;
                    } else {
                        authState.setState(AuthProtocolState.HANDSHAKE);
                        return true;
                    }
                } else {
                    authState.reset();
                    // Retry authentication with a different scheme
                }
            }
        }
        Queue<AuthOption> authOptions = authStrategy.select(challenges, host, response, context);
        if (authOptions != null && !authOptions.isEmpty()) {
            if (this.log.isDebugEnabled()) {
                this.log.debug("Selected authentication options: " + authOptions);
            }
            authState.setState(AuthProtocolState.CHALLENGED);
            authState.update(authOptions);
            return true;
        } else {
            return false;
        }
    } catch (MalformedChallengeException ex) {
        if (this.log.isWarnEnabled()) {
            this.log.warn("Malformed challenge: " +  ex.getMessage());
        }
        authState.reset();
        return false;
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:75,代碼來源:HttpAuthenticator.java

示例12: handleAuthChallenge

import org.apache.http.auth.AuthScheme; //導入方法依賴的package包/類
public boolean handleAuthChallenge(
        final HttpHost host,
        final HttpResponse response,
        final AuthenticationStrategy authStrategy,
        final AuthState authState,
        final HttpContext context) {
    try {
        if (this.log.isDebugEnabled()) {
            this.log.debug(host.toHostString() + " requested authentication");
        }
        final Map<String, Header> challenges = authStrategy.getChallenges(host, response, context);
        if (challenges.isEmpty()) {
            this.log.debug("Response contains no authentication challenges");
            return false;
        }

        final AuthScheme authScheme = authState.getAuthScheme();
        switch (authState.getState()) {
        case FAILURE:
            return false;
        case SUCCESS:
            authState.reset();
            break;
        case CHALLENGED:
        case HANDSHAKE:
            if (authScheme == null) {
                this.log.debug("Auth scheme is null");
                authStrategy.authFailed(host, null, context);
                authState.reset();
                authState.setState(AuthProtocolState.FAILURE);
                return false;
            }
        case UNCHALLENGED:
            if (authScheme != null) {
                final String id = authScheme.getSchemeName();
                final Header challenge = challenges.get(id.toLowerCase(Locale.ROOT));
                if (challenge != null) {
                    this.log.debug("Authorization challenge processed");
                    authScheme.processChallenge(challenge);
                    if (authScheme.isComplete()) {
                        this.log.debug("Authentication failed");
                        authStrategy.authFailed(host, authState.getAuthScheme(), context);
                        authState.reset();
                        authState.setState(AuthProtocolState.FAILURE);
                        return false;
                    } else {
                        authState.setState(AuthProtocolState.HANDSHAKE);
                        return true;
                    }
                } else {
                    authState.reset();
                    // Retry authentication with a different scheme
                }
            }
        }
        final Queue<AuthOption> authOptions = authStrategy.select(challenges, host, response, context);
        if (authOptions != null && !authOptions.isEmpty()) {
            if (this.log.isDebugEnabled()) {
                this.log.debug("Selected authentication options: " + authOptions);
            }
            authState.setState(AuthProtocolState.CHALLENGED);
            authState.update(authOptions);
            return true;
        } else {
            return false;
        }
    } catch (final MalformedChallengeException ex) {
        if (this.log.isWarnEnabled()) {
            this.log.warn("Malformed challenge: " +  ex.getMessage());
        }
        authState.reset();
        return false;
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:75,代碼來源:HttpAuthenticator.java

示例13: updateAuthState

import org.apache.http.auth.AuthScheme; //導入方法依賴的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

示例14: updateAuthState

import org.apache.http.auth.AuthScheme; //導入方法依賴的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

示例15: updateAuthState

import org.apache.http.auth.AuthScheme; //導入方法依賴的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


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