Package org.apache.jmeter.protocol.http.control

Examples of org.apache.jmeter.protocol.http.control.Authorization


      // set the auth. thanks to KiYun Roe for contributing the patch
      // I cleaned up the patch slightly. 5-26-05
      if (getAuthManager() != null) {
        if (getAuthManager().getAuthForURL(getUrl()) != null) {
          AuthManager authmanager = getAuthManager();
          Authorization auth = authmanager.getAuthForURL(getUrl());
          spconn.setUserName(auth.getUser());
          spconn.setPassword(auth.getPass());
        } else {
          log.warn("the URL for the auth was null." + " Username and password not set");
        }
      }
      // check the proxy
View Full Code Here


   *            the <code>AuthManager</code> containing all the cookies for
   *            this <code>UrlConfig</code>
   */
  private void setConnectionAuthorization(HttpURLConnection conn, URL u, AuthManager authManager) {
    if (authManager != null) {
      Authorization auth = authManager.getAuthForURL(u);
      if (auth != null) {
        conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader());
      }
    }
  }
View Full Code Here

   *            this <code>UrlConfig</code>
   */
    private void setConnectionAuthorization(HttpClient client, URL u, AuthManager authManager) {
    HttpParams params = client.getParams();
    if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " >  D="+ username + " D="+domain+" R="+realm);
                    }
          client.getState().setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                realm.length()==0 ? null : realm //"" is not the same as no realm
                                ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                  username,
                                    auth.getPass(),
                                    localHost,
                  domain
              ));
          // We have credentials - should we set pre-emptive authentication?
          if (canSetPreEmptive){
View Full Code Here

     */
    private void setConnectionAuthorization(HttpClient client, URL u, AuthManager authManager) {
        HttpState state = client.getState();
        if (authManager != null) {
            HttpClientParams params = client.getParams();
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " >  D="+ username + " D="+domain+" R="+realm);
                    }
                    state.setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                    realm.length()==0 ? null : realm //"" is not the same as no realm
                                    ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                                    username,
                                    auth.getPass(),
                                    localHost,
                                    domain
                            ));
                    // We have credentials - should we set pre-emptive authentication?
                    if (canSetPreEmptive){
View Full Code Here

   *            the <code>AuthManager</code> containing all the cookies for
   *            this <code>UrlConfig</code>
   */
  private void setConnectionAuthorization(HttpURLConnection conn, URL u, AuthManager authManager) {
    if (authManager != null) {
      Authorization auth = authManager.getAuthForURL(u);
      if (auth != null) {
        conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader());
      }
    }
  }
View Full Code Here

   *            this <code>UrlConfig</code>
   */
  void setConnectionAuthorization(HttpClient client, URL u, AuthManager authManager) {
    HttpParams params = client.getParams();
    if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " >  D="+ username + " D="+domain+" R="+realm);
                    }
          client.getState().setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                realm.length()==0 ? null : realm //"" is not the same as no realm
                                ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                  username,
                                    auth.getPass(),
                                    localHost,
                  domain
              ));
          // We have credentials - should we set pre-emptive authentication?
          if (canSetPreEmptive){
View Full Code Here

     *            the <code>AuthManager</code> containing all the cookies for
     *            this <code>UrlConfig</code>
     */
    private void setConnectionAuthorization(HttpURLConnection conn, URL u, AuthManager authManager) {
        if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                conn.setRequestProperty(HTTPConstants.HEADER_AUTHORIZATION, auth.toBasicHeader());
            }
        }
    }
View Full Code Here

    private void setConnectionAuthorization(HttpClient client, URL url, AuthManager authManager) {
        CredentialsProvider credentialsProvider =
            ((AbstractHttpClient) client).getCredentialsProvider();
        if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(url);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " > D="+domain+" R="+realm);
                    }
                    credentialsProvider.setCredentials(
                            new AuthScope(url.getHost(), url.getPort(), realm.length()==0 ? null : realm),
                            new NTCredentials(username, auth.getPass(), localHost, domain));
            } else {
                credentialsProvider.clear();
            }
        } else {
            credentialsProvider.clear();           
View Full Code Here

            // set the auth. thanks to KiYun Roe for contributing the patch
            // I cleaned up the patch slightly. 5-26-05
            if (getAuthManager() != null) {
                if (getAuthManager().getAuthForURL(getUrl()) != null) {
                    AuthManager authmanager = getAuthManager();
                    Authorization auth = authmanager.getAuthForURL(getUrl());
                    spconn.setUserName(auth.getUser());
                    spconn.setPassword(auth.getPass());
                } else {
                    log.warn("the URL for the auth was null." + " Username and password not set");
                }
            }
            // check the proxy
View Full Code Here

        /**
         * Required by table model interface.
         */
        public Object getValueAt(int row, int column) {
            Authorization auth = manager.getAuthObjectAt(row);

            switch (column){
                case AuthManager.COL_URL:
                    return auth.getURL();
                case AuthManager.COL_USERNAME:
                    return auth.getUser();
                case AuthManager.COL_PASSWORD:
                    return auth.getPass();
                case AuthManager.COL_DOMAIN:
                    return auth.getDomain();
                case AuthManager.COL_REALM:
                    return auth.getRealm();
                default:
                    return null;
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.protocol.http.control.Authorization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.