Class AuthManager
-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable,org.apache.jmeter.config.ConfigElement,org.apache.jmeter.gui.Searchable,org.apache.jmeter.testelement.TestElement,org.apache.jmeter.testelement.TestIterationListener,org.apache.jmeter.testelement.TestStateListener
public class AuthManager extends ConfigTestElement implements TestStateListener, TestIterationListener, Serializable
This class provides a way to provide Authorization in jmeter requests. The format of the authorization file is: URL user pass where URL is an HTTP URL, user a username to use and pass the appropriate password.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumAuthManager.Mechanism
-
Field Summary
Fields Modifier and Type Field Description public final static intCOL_URLpublic final static intCOL_USERNAMEpublic final static intCOL_PASSWORDpublic final static intCOL_DOMAINpublic final static intCOL_REALMpublic final static intCOL_MECHANISMpublic final static booleanSTRIP_PORTpublic final static booleanUSE_CANONICAL_HOST_NAMEpublic final static StringUSERNAMEpublic final static StringPASSWORDpublic transient JMeterContextthreadContextpublic transient StringthreadNamepublic final static TestElement.CompanionCompanionpublic final static StringNAMEpublic final static StringGUI_CLASSpublic final static StringENABLEDpublic final static StringTEST_CLASSpublic final static StringCOMMENTS
-
Constructor Summary
Constructors Constructor Description AuthManager()Default Constructor.
-
Method Summary
Modifier and Type Method Description voidclear()voidset(int index, String url, String user, String pass, String domain, String realm, AuthManager.Mechanism mechanism)Update an authentication record. CollectionPropertygetAuthObjects()intgetColumnCount()StringgetColumnName(int column)Class<out Object>getColumnClass(int column)AuthorizationgetAuthObjectAt(int row)booleanisEditable()Authorizationget(int i)Return the record at index i StringgetAuthHeaderForURL(URL url)AuthorizationgetAuthForURL(URL url)booleanhasAuthForURL(URL url)Tests whether an authorization record is available for a given URL SubjectgetSubjectForUrl(URL url)Get a Subject for a given URL, if available voidaddConfigElement(ConfigElement config)voidaddAuth(Authorization newAuthorization)Add newAuthorization if it does not already exist voidaddAuth()booleanexpectsModification()voidsave(String authFile)Save the authentication data to a file. voidaddFile(String authFile)Add authentication data from a file. voidremove(int index)Remove an authentication record. booleangetClearEachIteration()voidsetClearEachIteration(boolean clear)intgetAuthCount()Return the number of records. static voidsetupCredentials(Authorization auth, URL url, HttpClientContext localContext, CredentialsProvider credentialsProvider, String localhost)Configure credentials and auth scheme on client if an authorization is voidtestStarted()voidtestEnded()voidtestStarted(String host)voidtestEnded(String host)voidtestIterationStart(LoopIterationEvent event)booleangetControlledByThread()voidsetControlledByThread(boolean control)-
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
canRemove, clearTestElementChildren, clone, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse -
Methods inherited from class org.apache.jmeter.config.ConfigTestElement
addTestElement, getProps, getSchema -
Methods inherited from class org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProps, getSchema, getString, removed, set -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
clear
void clear()
-
set
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- authentication Mechanism to use
-
getAuthObjects
CollectionProperty getAuthObjects()
-
getColumnCount
int getColumnCount()
-
getColumnName
String getColumnName(int column)
-
getColumnClass
Class<out Object> getColumnClass(int column)
-
getAuthObjectAt
Authorization getAuthObjectAt(int row)
-
isEditable
boolean isEditable()
-
get
Authorization get(int i)
Return the record at index i
- Parameters:
i- index of the record to get
-
getAuthHeaderForURL
String getAuthHeaderForURL(URL url)
-
getAuthForURL
Authorization getAuthForURL(URL url)
-
hasAuthForURL
boolean hasAuthForURL(URL url)
Tests whether an authorization record is available for a given URL
- Parameters:
url- URL for which an authorization record should be available
-
getSubjectForUrl
Subject getSubjectForUrl(URL url)
Get a Subject for a given URL, if available
- Parameters:
url- URL for which the subject was asked
-
addConfigElement
void addConfigElement(ConfigElement config)
-
addAuth
void addAuth(Authorization newAuthorization)
Add newAuthorization if it does not already exist
- Parameters:
newAuthorization- authorization to be added
-
addAuth
void addAuth()
-
expectsModification
boolean expectsModification()
-
save
void save(String authFile)
Save the authentication data to a file.
- Parameters:
authFile- path of the file to save the authentication data to
-
addFile
void addFile(String authFile)
Add authentication data from a file.
- Parameters:
authFile- path to the file to read the authentication data from
-
remove
void remove(int index)
Remove an authentication record.
- Parameters:
index- index of the authentication record to remove
-
getClearEachIteration
boolean getClearEachIteration()
-
setClearEachIteration
void setClearEachIteration(boolean clear)
-
getAuthCount
int getAuthCount()
Return the number of records.
-
setupCredentials
static void setupCredentials(Authorization auth, URL url, HttpClientContext localContext, 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 for NTCredentials
-
testStarted
void testStarted()
-
testEnded
void testEnded()
-
testStarted
void testStarted(String host)
-
testIterationStart
void testIterationStart(LoopIterationEvent event)
-
getControlledByThread
boolean getControlledByThread()
-
setControlledByThread
void setControlledByThread(boolean control)
-
-
-
-