Search in sources :

Example 1 with AuthManager

use of org.apache.jmeter.protocol.http.control.AuthManager in project jmeter by apache.

the class HTTPSamplerBase method setAuthManager.

public void setAuthManager(AuthManager value) {
    AuthManager mgr = getAuthManager();
    if (mgr != null) {
        if (log.isWarnEnabled()) {
            log.warn("Existing AuthManager {} superseded by {}", mgr.getName(), value.getName());
        }
    }
    setProperty(new TestElementProperty(AUTH_MANAGER, value));
}
Also used : AuthManager(org.apache.jmeter.protocol.http.control.AuthManager) TestElementProperty(org.apache.jmeter.testelement.property.TestElementProperty)

Example 2 with AuthManager

use of org.apache.jmeter.protocol.http.control.AuthManager in project jmeter by apache.

the class ProxyControl method setAuthorization.

/**
     * Find if there is any AuthManager in JMeterTreeModel
     * If there is no one, create and add it to tree
     * Add authorization object to AuthManager
     * @param authorization {@link Authorization}
     * @param target {@link JMeterTreeNode}
     */
private void setAuthorization(Authorization authorization, JMeterTreeNode target) {
    JMeterTreeModel jmeterTreeModel = getJmeterTreeModel();
    List<JMeterTreeNode> authManagerNodes = jmeterTreeModel.getNodesOfType(AuthManager.class);
    if (authManagerNodes.isEmpty()) {
        try {
            log.debug("Creating HTTP Authentication manager for authorization:" + authorization);
            AuthManager authManager = newAuthorizationManager(authorization);
            jmeterTreeModel.addComponent(authManager, target);
        } catch (IllegalUserActionException e) {
            log.error("Failed to add Authorization Manager to target node:" + target.getName(), e);
        }
    } else {
        AuthManager authManager = (AuthManager) authManagerNodes.get(0).getTestElement();
        authManager.addAuth(authorization);
    }
}
Also used : JMeterTreeModel(org.apache.jmeter.gui.tree.JMeterTreeModel) AuthManager(org.apache.jmeter.protocol.http.control.AuthManager) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode) IllegalUserActionException(org.apache.jmeter.exceptions.IllegalUserActionException)

Example 3 with AuthManager

use of org.apache.jmeter.protocol.http.control.AuthManager in project jmeter by apache.

the class ProxyControl method newAuthorizationManager.

/**
     * Construct AuthManager
     * @param authorization
     * @return AuthManager
     * @throws IllegalUserActionException
     */
private AuthManager newAuthorizationManager(Authorization authorization) throws IllegalUserActionException {
    AuthManager authManager = new AuthManager();
    authManager.setProperty(TestElement.GUI_CLASS, AUTH_PANEL);
    authManager.setProperty(TestElement.TEST_CLASS, AUTH_MANAGER);
    authManager.setName("HTTP Authorization Manager");
    authManager.addAuth(authorization);
    return authManager;
}
Also used : AuthManager(org.apache.jmeter.protocol.http.control.AuthManager)

Example 4 with AuthManager

use of org.apache.jmeter.protocol.http.control.AuthManager in project jmeter by apache.

the class AuthPanel method createTestElement.

@Override
public TestElement createTestElement() {
    AuthManager authMan = tableModel.manager;
    configureTestElement(authMan);
    authMan.setClearEachIteration(clearEachIteration.isSelected());
    return (TestElement) authMan.clone();
}
Also used : AuthManager(org.apache.jmeter.protocol.http.control.AuthManager) TestElement(org.apache.jmeter.testelement.TestElement)

Example 5 with AuthManager

use of org.apache.jmeter.protocol.http.control.AuthManager in project jmeter by apache.

the class AuthPanel method modifyTestElement.

/**
     * Modifies a given TestElement to mirror the data in the gui components.
     *
     * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
     */
@Override
public void modifyTestElement(TestElement el) {
    GuiUtils.stopTableEditing(authTable);
    AuthManager authManager = (AuthManager) el;
    authManager.clear();
    authManager.addTestElement((TestElement) tableModel.manager.clone());
    authManager.setClearEachIteration(clearEachIteration.isSelected());
    configureTestElement(el);
}
Also used : AuthManager(org.apache.jmeter.protocol.http.control.AuthManager)

Aggregations

AuthManager (org.apache.jmeter.protocol.http.control.AuthManager)8 HeaderManager (org.apache.jmeter.protocol.http.control.HeaderManager)2 HTTPFileArg (org.apache.jmeter.protocol.http.util.HTTPFileArg)2 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 PrivilegedActionException (java.security.PrivilegedActionException)1 Subject (javax.security.auth.Subject)1 HttpHost (org.apache.http.HttpHost)1 AuthCache (org.apache.http.client.AuthCache)1 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)1 BasicScheme (org.apache.http.impl.auth.BasicScheme)1 BasicAuthCache (org.apache.http.impl.client.BasicAuthCache)1 IllegalUserActionException (org.apache.jmeter.exceptions.IllegalUserActionException)1 JMeterTreeModel (org.apache.jmeter.gui.tree.JMeterTreeModel)1 JMeterTreeNode (org.apache.jmeter.gui.tree.JMeterTreeNode)1 Authorization (org.apache.jmeter.protocol.http.control.Authorization)1 CookieManager (org.apache.jmeter.protocol.http.control.CookieManager)1 Header (org.apache.jmeter.protocol.http.control.Header)1