Class AuthManager
- All Implemented Interfaces:
Serializable,Cloneable,ConfigElement,Searchable,org.apache.jmeter.testelement.TestElement,TestIterationListener,TestStateListener
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.jmeter.testelement.TestElement
org.apache.jmeter.testelement.TestElement.Companion -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final booleanDecides whether port should be omitted from SPN for Kerberos SPNEGO authenticationstatic final booleanDecides whether SPN for Kerberos SPNEGO authentication should be acquired for the canonicalized host nameFields inherited from class org.apache.jmeter.config.ConfigTestElement
PASSWORD, USERNAMEFields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, Companion, ENABLED, GUI_CLASS, NAME, TEST_CLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuth()voidaddAuth(Authorization newAuthorization) Add newAuthorization if it does not already existvoidaddConfigElement(ConfigElement config) Add a configuration element to this one.voidAdd authentication data from a file.voidclear()booleanIf 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.get(int i) Return the record at index iintReturn the number of records.getAuthForURL(URL url) getAuthHeaderForURL(URL url) getAuthObjectAt(int row) booleanClass<?>getColumnClass(int column) intgetColumnName(int column) booleangetSubjectForUrl(URL url) Get aSubjectfor a given URL, if availablebooleanhasAuthForURL(URL url) Tests whether an authorization record is available for a given URLbooleanvoidremove(int index) Remove an authentication record.voidSave the authentication data to a file.voidset(int index, String url, String user, String pass, String domain, String realm, AuthManager.Mechanism mechanism) Update an authentication record.voidsetClearEachIteration(boolean clear) voidsetControlledByThread(boolean control) voidsetupCredentials(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 isvoidCalled once for all threads after the end of a test.voidCalled once for all threads after the end of a test.voidEach time through a Thread Group's test script, an iteration event is fired for each thread.voidCalled just before the start of the test from the main engine thread.voidtestStarted(String host) Called just before the start of the test from the main engine thread.Methods inherited from class org.apache.jmeter.config.ConfigTestElement
addTestElement, getProps, getSchemaMethods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, 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, traversePropertyMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jmeter.config.ConfigElement
cloneMethods inherited from interface org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getPropertyOrNull, getString, removed, removeProperty, set, set, set, set, set, set, set, set, set
-
Field Details
-
COL_URL
public static final int COL_URL- See Also:
-
COL_USERNAME
public static final int COL_USERNAME- See Also:
-
COL_PASSWORD
public static final int COL_PASSWORD- See Also:
-
COL_DOMAIN
public static final int COL_DOMAIN- See Also:
-
COL_REALM
public static final int COL_REALM- See Also:
-
COL_MECHANISM
public static final int COL_MECHANISM- See Also:
-
STRIP_PORT
public static final boolean STRIP_PORTDecides whether port should be omitted from SPN for Kerberos SPNEGO authentication -
USE_CANONICAL_HOST_NAME
public static final boolean USE_CANONICAL_HOST_NAMEDecides whether SPN for Kerberos SPNEGO authentication should be acquired for the canonicalized host name
-
-
Constructor Details
-
AuthManager
public AuthManager()Default Constructor.
-
-
Method Details
-
clear
public void clear()- Specified by:
clearin interfaceorg.apache.jmeter.testelement.TestElement- Overrides:
clearin classAbstractTestElement
-
set
public void set(int index, String url, String user, String pass, String domain, String realm, AuthManager.Mechanism mechanism) Update an authentication record.- Parameters:
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- authenticationAuthManager.Mechanismto use
-
getAuthObjects
-
getColumnCount
public int getColumnCount() -
getColumnName
-
getColumnClass
-
getAuthObjectAt
-
isEditable
public boolean isEditable() -
get
Return the record at index i- Parameters:
i- index of the record to get- Returns:
- authorization record at index
i
-
getAuthHeaderForURL
-
getAuthForURL
-
hasAuthForURL
Tests whether an authorization record is available for a given URL- Parameters:
url-URLfor which an authorization record should be available- Returns:
trueif an authorization is setup for url,falseotherwise
-
getSubjectForUrl
Get aSubjectfor a given URL, if available- Parameters:
url-URLfor which the subject was asked- Returns:
- Subject if Auth Scheme uses Subject and an authorization is setup
for
url,nullotherwise
-
addConfigElement
Add a configuration element to this one. This allows config elements to combine and give a "layered" effect. For example, HTTPConfigElements have properties for domain, path, method, and parameters. If element A has everything filled in, but null for domain, and element B is added, which has only domain filled in, then after adding B to A, A will have the domain from B. If A already had a domain, then the correct behavior is for A to ignore the addition of element B.- Specified by:
addConfigElementin interfaceConfigElement- Overrides:
addConfigElementin classConfigTestElement- Parameters:
config- the element to be added to this ConfigElement
-
addAuth
Add newAuthorization if it does not already exist- Parameters:
newAuthorization- authorization to be added
-
addAuth
public void addAuth() -
expectsModification
public 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. Your config element will not be cloned for each sample. If your config elements are more static in nature, return false. If in doubt, return false.- Specified by:
expectsModificationin interfaceConfigElement- Overrides:
expectsModificationin classConfigTestElement- Returns:
- true if the element expects to be modified over the course of a test run
-
save
Save the authentication data to a file.- Parameters:
authFile- path of the file to save the authentication data to- Throws:
IOException- when writing to the file fails
-
addFile
Add authentication data from a file.- Parameters:
authFile- path to the file to read the authentication data from- Throws:
IOException- when reading the data fails
-
remove
public void remove(int index) Remove an authentication record.- Parameters:
index- index of the authentication record to remove
-
getClearEachIteration
public boolean getClearEachIteration()- Returns:
- true if kerberos auth must be cleared on each mail loop iteration
-
setClearEachIteration
public void setClearEachIteration(boolean clear) -
getAuthCount
public int getAuthCount()Return the number of records.- Returns:
- the number of records
-
setupCredentials
public 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- Parameters:
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 forNTCredentials
-
testStarted
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.
- Specified by:
testStartedin interfaceTestStateListener- See Also:
-
testEnded
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.
- Specified by:
testEndedin interfaceTestStateListener- See Also:
-
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.
- Specified by:
testStartedin interfaceTestStateListener- Parameters:
host- name of host- See Also:
-
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.
- Specified by:
testEndedin interfaceTestStateListener- Parameters:
host- name of host- See Also:
-
testIterationStart
Each time through a Thread Group's test script, an iteration event is fired for each thread. This will be after the test elements have been cloned, so in general the instance will not be the same as the ones the start/end methods call.- Specified by:
testIterationStartin interfaceTestIterationListener- Parameters:
event- the iteration event
-
getControlledByThread
public boolean getControlledByThread() -
setControlledByThread
public void setControlledByThread(boolean control)
-