public class AuthManager extends ConfigTestElement implements TestStateListener, TestIterationListener, 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 |
static boolean |
STRIP_PORT
Decides whether port should be omitted from SPN for kerberos spnego authentication
|
static boolean |
USE_CANONICAL_HOST_NAME
Decides whether port should be omitted from SPN for kerberos spnego authentication
|
PASSWORD, USERNAME
COMMENTS, 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(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(URL url) |
String |
getAuthHeaderForURL(URL url) |
Authorization |
getAuthObjectAt(int row) |
CollectionProperty |
getAuthObjects() |
boolean |
getClearEachIteration() |
Class<?> |
getColumnClass(int column) |
int |
getColumnCount() |
String |
getColumnName(int column) |
boolean |
getControlledByThread() |
Subject |
getSubjectForUrl(URL url)
Get a
Subject for a given URL, if available |
boolean |
hasAuthForURL(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(String authFile)
Save the authentication data to a file.
|
void |
set(int index,
String url,
String user,
String pass,
String domain,
String realm,
AuthManager.Mechanism mechanism)
Update an authentication record.
|
void |
setClearEachIteration(boolean clear) |
void |
setControlledByThread(boolean control) |
void |
setupCredentials(Authorization auth,
URL url,
org.apache.http.client.protocol.HttpClientContext localContext,
org.apache.http.client.CredentialsProvider credentialsProvider,
String localhost)
Configure credentials and auth scheme on client if an authorization is
|
void |
testEnded()
Called once for all threads after the end of a test.
|
void |
testEnded(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(String host)
Called just before the start of the test from the main engine thread.
|
addTestElement
addPropertiesValues, 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, traverseProperty
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
clone
removed
public 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 static final boolean STRIP_PORT
public static final boolean USE_CANONICAL_HOST_NAME
public void clear()
clear
in interface TestElement
clear
in class AbstractTestElement
public void set(int index, String url, String user, String pass, String domain, 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 String getColumnName(int column)
public Class<?> getColumnClass(int column)
public Authorization getAuthObjectAt(int row)
public boolean isEditable()
public Authorization get(int i)
i
- index of the record to geti
public Authorization getAuthForURL(URL url)
public boolean hasAuthForURL(URL url)
url
- URL
for which an authorization record should be
availabletrue
if an authorization is setup for url,
false
otherwisepublic Subject getSubjectForUrl(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 ConfigElement
addConfigElement
in class ConfigTestElement
config
- 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 ConfigElement
expectsModification
in class ConfigTestElement
public void save(String authFile) throws IOException
authFile
- path of the file to save the authentication data toIOException
- when writing to the file failspublic void addFile(String authFile) throws IOException
authFile
- path to the file to read the authentication data fromIOException
- 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(Authorization auth, URL url, org.apache.http.client.protocol.HttpClientContext localContext, org.apache.http.client.CredentialsProvider credentialsProvider, String localhost)
auth
- information about the authorization to useurl
- the URL for which the authorization info should be usedlocalContext
- http client context which should be set upcredentialsProvider
- provider which should be set uplocalhost
- name of the workstation to be used for NTCredentials
public 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 TestStateListener
StandardJMeterEngine.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 TestStateListener
StandardJMeterEngine.stopTest()
public void testStarted(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 TestStateListener
host
- name of hostStandardJMeterEngine.run()
public void testEnded(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 TestStateListener
host
- name of hostStandardJMeterEngine.stopTest()
public void testIterationStart(LoopIterationEvent event)
testIterationStart
in interface TestIterationListener
event
- the iteration eventpublic boolean getControlledByThread()
public void setControlledByThread(boolean control)
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.