Package us.abstracta.jmeter.javadsl.http
Class DslAuthManager
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
-
- us.abstracta.jmeter.javadsl.core.configs.BaseConfigElement
-
- us.abstracta.jmeter.javadsl.http.DslAuthManager
-
- All Implemented Interfaces:
DslConfig,DslTestElement,DslTestPlan.TestPlanChild,BaseSampler.SamplerChild,MultiLevelTestElement,BaseThreadGroup.ThreadGroupChild
public class DslAuthManager extends BaseConfigElement
Allows specifying HTTP authentication to be automatically included in HTTP requests.This is a handy way of specifying HTTP authentication without having to worry about particular requests or HTTP header handling.
When specifying multiple authentications, consider that the first matching authentication will be applied. So, if you have two urls with different authentication which one is contained by the other, define the longest one first and then the shorter one to get expected behavior. E.g:
httpAuth() .basicAuth("http://myservice/user", "user1", "pass1") .basicAuth("http://myservice", "user2", "pass2")- Since:
- 1.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDslAuthManager.CodeBuilder
-
Field Summary
-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
guiClass, name
-
-
Constructor Summary
Constructors Constructor Description DslAuthManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DslAuthManagerbasicAuth(String baseUrl, String user, String password)Specifies authentication credentials to use with HTTP Basic authentication for a given base url.protected org.apache.jmeter.testelement.TestElementbuildTestElement()-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
buildConfiguredTestElement, buildTestElementGui, buildTreeUnder, configureTestElement, durationToSeconds, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showInGui, showTestElementGui
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface us.abstracta.jmeter.javadsl.core.DslTestElement
buildTreeUnder, showInGui
-
-
-
-
Method Detail
-
basicAuth
public DslAuthManager basicAuth(String baseUrl, String user, String password)
Specifies authentication credentials to use with HTTP Basic authentication for a given base url.- Parameters:
baseUrl- allows filtering requests to which HTTP Basic authentication should be sent. All requests with a URL starting with this given base url will include Basic authentication.Even though you can use empty string to match any URL and simplify configuration, this is not advised since it may lead to sending the authentication credentials to an unexpected URL and cause a security leak.
user- specifies the username for the basic authentication.password- specifies the password for the basic authentication.- Returns:
- the test element for further configuration and usage.
-
buildTestElement
protected org.apache.jmeter.testelement.TestElement buildTestElement()
- Specified by:
buildTestElementin classBaseTestElement
-
-