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

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


     *@param column  !ToDo (Parameter description)
     *@return        !ToDo (Return description)
     ***************************************/
    public Object getValueAt(int row, int column)
    {
      Authorization auth = manager.getAuthObjectAt(row);

      if(column == 0)
      {
        return auth.getURL();
      }
      else if(column == 1)
      {
        return auth.getUser();
      }
      else if(column == 2)
      {
        return auth.getPass();
      }
      return null;
    }
View Full Code Here


     *@param row     !ToDo (Parameter description)
     *@param column  !ToDo (Parameter description)
     ***************************************/
    public void setValueAt(Object value, int row, int column)
    {
      Authorization auth = manager.getAuthObjectAt(row);

      if(column == 0)
      {
        auth.setURL((String)value);
      }
      else if(column == 1)
      {
        auth.setUser((String)value);
      }
      else if(column == 2)
      {
        auth.setPass((String)value);
      }
    }
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

        /**
         * Required by table model interface.
         */
        @Override
        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();
                case AuthManager.COL_MECHANISM:
                    return auth.getMechanism();
                default:
                    return null;
            }
        }
View Full Code Here

            }
        }

        @Override
        public void setValueAt(Object value, int row, int column) {
            Authorization auth = manager.getAuthObjectAt(row);
            log.debug("Setting auth value: " + value);
            switch (column){
                case AuthManager.COL_URL:
                    auth.setURL((String) value);
                    break;
                case AuthManager.COL_USERNAME:
                    auth.setUser((String) value);
                    break;
                case AuthManager.COL_PASSWORD:
                    auth.setPass((String) value);
                    break;
                case AuthManager.COL_DOMAIN:
                    auth.setDomain((String) value);
                    break;
                case AuthManager.COL_REALM:
                    auth.setRealm((String) value);
                    break;
                case AuthManager.COL_MECHANISM:
                    auth.setMechanism((Mechanism) value);
                    break;
                default:
                    break;
            }
        }
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

            // 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(HTTPConstants.HEADER_AUTHORIZATION, auth.toBasicHeader());
            }
        }
    }
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

          return null;
      }
    }

    public void setValueAt(Object value, int row, int column) {
      Authorization auth = manager.getAuthObjectAt(row);
      log.debug("Setting auth value: " + value);
      switch (column){
        case AuthManager.COL_URL:
          auth.setURL((String) value);
          break;
        case AuthManager.COL_USERNAME:
          auth.setUser((String) value);
          break;
        case AuthManager.COL_PASSWORD:
          auth.setPass((String) value);
          break;
        case AuthManager.COL_DOMAIN:
          auth.setDomain((String) value);
          break;
        case AuthManager.COL_REALM:
          auth.setRealm((String) value);
          break;
        default:
          break;
        }
    }
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.