public class AuthManager extends ConfigTestElement implements TestStateListener, TestIterationListener, java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
AuthManager.Mechanism |
| Modifier and Type | Field and Description |
|---|---|
static int |
COL_DOMAIN |
static int |
COL_MECHANISM |
static int |
COL_PASSWORD |
static int |
COL_REALM |
static int |
COL_URL |
static int |
COL_USERNAME |
PASSWORD, USERNAMECOMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS| Constructor and Description |
|---|
AuthManager()
Default Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAuth() |
void |
addAuth(Authorization newAuthorization)
Add newAuthorization if it does not already exist
|
void |
addConfigElement(ConfigElement config)
Add a configuration element to this one.
|
void |
addFile(java.lang.String authFile)
Add authentication data from a file.
|
void |
clear()
Clear the TestElement of all data.
|
boolean |
expectsModification()
If your config element expects to be modified in the process of a test
run, and you want those modifications to carry over from sample to sample
(as in a cookie manager - you want to save all cookies that get set
throughout the test), then return true for this method.
|
Authorization |
get(int i)
Return the record at index i
|
int |
getAuthCount()
Return the number of records.
|
Authorization |
getAuthForURL(java.net.URL url) |
java.lang.String |
getAuthHeaderForURL(java.net.URL url) |
Authorization |
getAuthObjectAt(int row) |
CollectionProperty |
getAuthObjects() |
boolean |
getClearEachIteration() |
java.lang.Class<?> |
getColumnClass(int column) |
int |
getColumnCount() |
java.lang.String |
getColumnName(int column) |
javax.security.auth.Subject |
getSubjectForUrl(java.net.URL url)
Get a
Subject for a given URL, if available |
boolean |
hasAuthForURL(java.net.URL url)
Tests whether an authorization record is available for a given URL
|
boolean |
isEditable() |
void |
remove(int index)
Remove an authentication record.
|
void |
save(java.lang.String authFile)
Save the authentication data to a file.
|
void |
set(int index,
java.lang.String url,
java.lang.String user,
java.lang.String pass,
java.lang.String domain,
java.lang.String realm,
AuthManager.Mechanism mechanism)
Update an authentication record.
|
void |
setClearEachIteration(boolean clear) |
void |
setupCredentials(org.apache.http.client.HttpClient client,
java.net.URL url,
org.apache.http.client.CredentialsProvider credentialsProvider,
java.lang.String localHost)
Configure credentials and auth scheme on client if an authorization is
available for url
|
void |
testEnded()
Called once for all threads after the end of a test.
|
void |
testEnded(java.lang.String host)
Called once for all threads after the end of a test.
|
void |
testIterationStart(LoopIterationEvent event)
Each time through a Thread Group's test script, an iteration event is
fired for each thread.
|
void |
testStarted()
Called just before the start of the test from the main engine thread.
|
void |
testStarted(java.lang.String host)
Called just before the start of the test from the main engine thread.
|
addTestElementaddPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traversePropertyfinalize, getClass, notify, notifyAll, toString, wait, wait, waitcloneremovedpublic static final int COL_URL
public static final int COL_USERNAME
public static final int COL_PASSWORD
public static final int COL_DOMAIN
public static final int COL_REALM
public static final int COL_MECHANISM
public void clear()
clear in interface TestElementclear in class AbstractTestElementpublic void set(int index,
java.lang.String url,
java.lang.String user,
java.lang.String pass,
java.lang.String domain,
java.lang.String realm,
AuthManager.Mechanism mechanism)
index - index at which position the record should be seturl - url for which the authentication record should be useduser - name of the userpass - password of the userdomain - domain of the userrealm - realm of the sitemechanism - authentication AuthManager.Mechanism to usepublic CollectionProperty getAuthObjects()
public int getColumnCount()
public java.lang.String getColumnName(int column)
public java.lang.Class<?> getColumnClass(int column)
public Authorization getAuthObjectAt(int row)
public boolean isEditable()
public Authorization get(int i)
i - index of the record to getipublic java.lang.String getAuthHeaderForURL(java.net.URL url)
public Authorization getAuthForURL(java.net.URL url)
public boolean hasAuthForURL(java.net.URL url)
url - URL for which an authorization record should be
availabletrue if an authorization is setup for url,
false otherwisepublic javax.security.auth.Subject getSubjectForUrl(java.net.URL url)
Subject for a given URL, if availableurl - URL for which the subject was askedurl, null otherwisepublic void addConfigElement(ConfigElement config)
addConfigElement in interface ConfigElementaddConfigElement in class ConfigTestElementconfig - the element to be added to this ConfigElementpublic void addAuth(Authorization newAuthorization)
newAuthorization - authorization to be addedpublic void addAuth()
public boolean expectsModification()
expectsModification in interface ConfigElementexpectsModification in class ConfigTestElementpublic void save(java.lang.String authFile)
throws java.io.IOException
authFile - path of the file to save the authentication data tojava.io.IOException - when writing to the file failspublic void addFile(java.lang.String authFile)
throws java.io.IOException
authFile - path to the file to read the authentication data fromjava.io.IOException - when reading the data failspublic void remove(int index)
index - index of the authentication record to removepublic boolean getClearEachIteration()
public void setClearEachIteration(boolean clear)
public int getAuthCount()
public void setupCredentials(org.apache.http.client.HttpClient client,
java.net.URL url,
org.apache.http.client.CredentialsProvider credentialsProvider,
java.lang.String localHost)
client - HttpClienturl - URL to testcredentialsProvider - CredentialsProviderlocalHost - host running JMeterpublic void testStarted()
Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.
N.B. testStarted() and testEnded() are called from different threads.
testStarted in interface TestStateListenerStandardJMeterEngine.run()public void testEnded()
Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
testEnded in interface TestStateListenerStandardJMeterEngine.stopTest()public void testStarted(java.lang.String host)
Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.
N.B. testStarted() and testEnded() are called from different threads.
testStarted in interface TestStateListenerhost - name of hostStandardJMeterEngine.run()public void testEnded(java.lang.String host)
Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
testEnded in interface TestStateListenerhost - name of hostStandardJMeterEngine.stopTest()public void testIterationStart(LoopIterationEvent event)
testIterationStart in interface TestIterationListenerevent - the iteration eventCopyright © 1998-2018 Apache Software Foundation. All Rights Reserved.