The Shibboleth V1 software has reached its End of Life and is no longer supported. This documentation is available for historical purposes only.

JMeterTesting

-- Main.FabTreb - 15 Jun 2006

Tech env:

Shibboleth 1.3

JMeter 2.1 with java 1.5

You'll find below a JMeter Workbench element containing a Simple Controller that simulates a login via Shibboleth.

We had to create this after migrating the authentication strategy of several applications from basic auth to Shibboleth.

You can save it in a .jmx file and merge it into your test plans via the JMeter interface.

You will probably have to update the HTTP Request urls to match your environment as well as the usr/pwd for authentication at the Identiy Provider.

The hosts and ports are configured via the CVS Data Set Config element and a file config.txt that you'll need to create.

Here's the format of the config.txt file:

targetResourceHost,targetResourcePort,idpHost,idpPort,spAssertionConsumerHost,spAssertionConsumerPort,targetRelativeUrl

This can be used to test the Shibboleth process or to replace basic HTTP Authorization Managers in your test plans.

Note that it must be copied into a Thread Group element as the first child.

Please feel free to correct/improve this post.

<jmeterTestPlan version="1.1" properties="1.7">
  <hashTree> 
	 <org.apache.jmeter.testelement.WorkBench> 
		<stringProp name="TestElement.gui_class">org.apache.jmeter.control.gui.WorkBenchGui</stringProp> 
		<stringProp name="TestElement.test_class">org.apache.jmeter.testelement.WorkBench</stringProp> 
		<stringProp name="TestElement.name">WorkBench</stringProp> 
		<boolProp name="TestElement.enabled">true</boolProp> 
	 </org.apache.jmeter.testelement.WorkBench> 
	 <hashTree> 
		<GenericController> 
		  <stringProp name="TestElement.gui_class">org.apache.jmeter.control.gui.LogicControllerGui</stringProp> 
		  <stringProp name="TestElement.test_class">org.apache.jmeter.control.GenericController</stringProp> 
		  <stringProp name="TestElement.name">Shibboleth</stringProp> 
		  <boolProp name="TestElement.enabled">true</boolProp> 
		</GenericController> 
		<hashTree> 
		  <CSVDataSet> 
			 <stringProp name="delimiter">,</stringProp> 
			 <stringProp name="TestElement.gui_class">org.apache.jmeter.testbeans.gui.TestBeanGUI</stringProp> 
			 <stringProp name="TestElement.test_class">org.apache.jmeter.config.CSVDataSet</stringProp> 
			 <stringProp name="variableNames">targetResourceHost,targetResourcePort,idpHost,idpPort,spAcsHost,spAcsPort,targetRelativeUrl</stringProp>

			 <stringProp name="TestElement.name">Shibboleth Config</stringProp> 
			 <boolProp name="TestElement.enabled">true</boolProp> 
			 <stringProp name="filename">config.txt</stringProp> 
		  </CSVDataSet> 
		  <hashTree/> 
		  <org.apache.jmeter.config.Arguments> 
			 <stringProp name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</stringProp> 
			 <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp> 
			 <collectionProp name="Arguments.arguments"> 
				<elementProp name="SpSecureCxtExists" elementType="org.apache.jmeter.config.Argument"> 
				  <stringProp name="Argument.metadata">=</stringProp> 
				  <stringProp name="Argument.value">false</stringProp> 
				  <stringProp name="Argument.name">SpSecureCxtExists</stringProp> 
				</elementProp> 
				<elementProp name="SAMLResponse" elementType="org.apache.jmeter.config.Argument"> 
				  <stringProp name="Argument.metadata">=</stringProp> 
				  <stringProp name="Argument.value">SAMLResponseEmpty</stringProp> 
				  <stringProp name="Argument.name">SAMLResponse</stringProp> 
				</elementProp> 
			 </collectionProp> 
			 <stringProp name="TestElement.name">Shibboleth Temp Variables</stringProp> 
			 <boolProp name="TestElement.enabled">true</boolProp> 
		  </org.apache.jmeter.config.Arguments> 
		  <hashTree/> 
		  <IfController> 
			 <stringProp name="IfController.condition">"${SpSecureCxtExists}" == "false"</stringProp> 
			 <stringProp name="TestElement.gui_class">org.apache.jmeter.control.gui.IfControllerPanel</stringProp> 
			 <stringProp name="TestElement.test_class">org.apache.jmeter.control.IfController</stringProp> 
			 <stringProp name="TestElement.name">If Not SpSecureCxtExists </stringProp> 
			 <boolProp name="TestElement.enabled">true</boolProp> 
		  </IfController> 
		  <hashTree> 
			 <HTTPSampler> 
				<stringProp name="HTTPSampler.path">/servlet/Authentication.AuthFedLogin</stringProp> 
				<stringProp name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp> 
				<stringProp name="HTTPSampler.method">GET</stringProp> 
				<boolProp name="HTTPSampler.use_keepalive">true</boolProp> 
				<stringProp name="HTTPSampler.protocol">http</stringProp> 
				<boolProp name="TestElement.enabled">true</boolProp> 
				<boolProp name="HTTPSampler.follow_redirects">true</boolProp> 
				<stringProp name="HTTPSampler.port">${targetResourcePort}</stringProp> 
				<elementProp name="HTTPsampler.Arguments" elementType="org.apache.jmeter.config.Arguments"> 
				  <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>

				  <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp> 
				  <collectionProp name="Arguments.arguments"> 
					 <elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						<stringProp name="Argument.metadata">=</stringProp> 
						<stringProp name="Argument.value">http://${targetResourceHost}:${targetResourcePort}${targetUrl}</stringProp>

						<boolProp name="HTTPArgument.use_equals">true</boolProp> 
						<stringProp name="Argument.name">nextUrl</stringProp> 
						<boolProp name="HTTPArgument.always_encode">true</boolProp> 
					 </elementProp> 
				  </collectionProp> 
				  <stringProp name="TestElement.name">Argument List</stringProp> 
				  <boolProp name="TestElement.enabled">true</boolProp> 
				</elementProp> 
				<stringProp name="HTTPSampler.mimetype"></stringProp> 
				<stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>

				<stringProp name="HTTPSampler.FILE_FIELD"></stringProp> 
				<stringProp name="TestElement.name">/servlet/Authentication.AuthFedLogin</stringProp> 
				<stringProp name="HTTPSampler.monitor">false</stringProp> 
				<stringProp name="HTTPSampler.domain">${targetResourceHost}</stringProp> 
				<stringProp name="HTTPSampler.FILE_NAME"></stringProp> 
				<boolProp name="HTTPSampler.auto_redirects">false</boolProp> 
			 </HTTPSampler> 
			 <hashTree> 
				<RegexExtractor> 
				  <stringProp name="RegexExtractor.default">false</stringProp> 
				  <stringProp name="TestElement.gui_class">org.apache.jmeter.extractor.gui.RegexExtractorGui</stringProp> 
				  <stringProp name="TestElement.test_class">org.apache.jmeter.extractor.RegexExtractor</stringProp> 
				  <stringProp name="RegexExtractor.regex">(${targetUrl})</stringProp> 
				  <stringProp name="TestElement.name">SpSecureCxtExists</stringProp> 
				  <boolProp name="TestElement.enabled">true</boolProp> 
				  <stringProp name="RegexExtractor.useHeaders">false</stringProp> 
				  <stringProp name="RegexExtractor.match_number">1</stringProp> 
				  <stringProp name="RegexExtractor.template">$1$</stringProp> 
				  <stringProp name="RegexExtractor.refname">SpSecureCxtExists</stringProp> 
				</RegexExtractor> 
				<hashTree/> 
			 </hashTree> 
			 <IfController> 
				<stringProp name="IfController.condition">"${SAMLResponse}" == "SAMLResponseEmpty"</stringProp>

				<stringProp name="TestElement.gui_class">org.apache.jmeter.control.gui.IfControllerPanel</stringProp> 
				<stringProp name="TestElement.test_class">org.apache.jmeter.control.IfController</stringProp> 
				<stringProp name="TestElement.name">If Not IdpSecureCxtExists </stringProp> 
				<boolProp name="TestElement.enabled">true</boolProp> 
			 </IfController> 
			 <hashTree> 
				<HTTPSampler> 
				  <stringProp name="HTTPSampler.path">/idp/authenticate</stringProp> 
				  <stringProp name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp>

				  <stringProp name="HTTPSampler.method">POST</stringProp> 
				  <boolProp name="HTTPSampler.use_keepalive">true</boolProp> 
				  <stringProp name="HTTPSampler.protocol">https</stringProp> 
				  <boolProp name="TestElement.enabled">true</boolProp> 
				  <boolProp name="HTTPSampler.follow_redirects">false</boolProp> 
				  <stringProp name="HTTPSampler.port">${idpPort}</stringProp> 
				  <elementProp name="HTTPsampler.Arguments" elementType="org.apache.jmeter.config.Arguments"> 
					 <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>

					 <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp> 
					 <collectionProp name="Arguments.arguments"> 
						<elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						  <stringProp name="Argument.metadata">=</stringProp> 
						  <stringProp name="Argument.value">testA</stringProp> 
						  <boolProp name="HTTPArgument.use_equals">true</boolProp> 
						  <stringProp name="Argument.name">j_username</stringProp> 
						  <stringProp name="HTTPArgument.encoded_name">j_username</stringProp> 
						  <stringProp name="HTTPArgument.always_encode">true</stringProp> 
						  <stringProp name="HTTPArgument.encoded_value">DieuxM1</stringProp> 
						</elementProp> 
						<elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						  <stringProp name="Argument.metadata">=</stringProp> 
						  <stringProp name="Argument.value">passwordA</stringProp> 
						  <boolProp name="HTTPArgument.use_equals">true</boolProp> 
						  <stringProp name="Argument.name">j_password</stringProp> 
						  <stringProp name="HTTPArgument.encoded_name">j_password</stringProp> 
						  <stringProp name="HTTPArgument.always_encode">true</stringProp> 
						  <stringProp name="HTTPArgument.encoded_value">aaaaaa</stringProp> 
						</elementProp> 
						<elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						  <stringProp name="Argument.metadata">=</stringProp> 
						  <stringProp name="Argument.value">Login</stringProp> 
						  <boolProp name="HTTPArgument.use_equals">true</boolProp> 
						  <stringProp name="Argument.name">Login</stringProp> 
						  <stringProp name="HTTPArgument.encoded_name">Login</stringProp> 
						  <stringProp name="HTTPArgument.always_encode">true</stringProp> 
						  <stringProp name="HTTPArgument.encoded_value">Login</stringProp> 
						</elementProp> 
					 </collectionProp> 
					 <stringProp name="TestElement.name">Argument List</stringProp> 
					 <boolProp name="TestElement.enabled">true</boolProp> 
				  </elementProp> 
				  <stringProp name="HTTPSampler.mimetype"></stringProp> 
				  <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>

				  <stringProp name="HTTPSampler.FILE_FIELD"></stringProp> 
				  <stringProp name="TestElement.name">/idp/authenticate</stringProp> 
				  <stringProp name="HTTPSampler.monitor">false</stringProp> 
				  <stringProp name="HTTPSampler.domain">${idpHost}</stringProp> 
				  <stringProp name="HTTPSampler.FILE_NAME"></stringProp> 
				  <boolProp name="HTTPSampler.auto_redirects">false</boolProp> 
				</HTTPSampler> 
				<hashTree/> 
				<HTTPSampler> 
				  <stringProp name="HTTPSampler.path">/idp/SSO</stringProp> 
				  <stringProp name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp>

				  <stringProp name="HTTPSampler.method">GET</stringProp> 
				  <boolProp name="HTTPSampler.use_keepalive">true</boolProp> 
				  <stringProp name="HTTPSampler.protocol">https</stringProp> 
				  <boolProp name="TestElement.enabled">true</boolProp> 
				  <boolProp name="HTTPSampler.follow_redirects">false</boolProp> 
				  <stringProp name="HTTPSampler.port">${idpPort}</stringProp> 
				  <elementProp name="HTTPsampler.Arguments" elementType="org.apache.jmeter.config.Arguments"> 
					 <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>

					 <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp> 
					 <collectionProp name="Arguments.arguments"> 
						<elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						  <stringProp name="Argument.metadata">=</stringProp> 
						  <stringProp name="Argument.value">cookie</stringProp> 
						  <boolProp name="HTTPArgument.use_equals">true</boolProp> 
						  <stringProp name="Argument.name">target</stringProp> 
						  <stringProp name="HTTPArgument.always_encode">true</stringProp> 
						  <stringProp name="HTTPArgument.encoded_name">target</stringProp> 
						  <stringProp name="HTTPArgument.encoded_value">cookie</stringProp> 
						</elementProp> 
						<elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						  <stringProp name="Argument.metadata">=</stringProp> 
						  <stringProp name="Argument.value">http://${spAcsHost}:${spAcsPort}/Shibboleth.sso/SAML/POST</stringProp>

						  <boolProp name="HTTPArgument.use_equals">true</boolProp> 
						  <stringProp name="Argument.name">shire</stringProp> 
						  <stringProp name="HTTPArgument.always_encode">true</stringProp> 
						  <stringProp name="HTTPArgument.encoded_name">shire</stringProp> 
						  <stringProp name="HTTPArgument.encoded_value">http%3A%2F%2F${spAcsHost}%3A${spAcsPort}%2FShibboleth.sso%2FSAML%2FPOST</stringProp>

						</elementProp> 
						<elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						  <stringProp name="Argument.metadata">=</stringProp> 
						  <stringProp name="Argument.value">https://${spAcsHost}/shibboleth</stringProp> 
						  <boolProp name="HTTPArgument.use_equals">true</boolProp> 
						  <stringProp name="Argument.name">providerId</stringProp> 
						  <stringProp name="HTTPArgument.always_encode">true</stringProp> 
						  <stringProp name="HTTPArgument.encoded_name">providerId</stringProp> 
						  <stringProp name="HTTPArgument.encoded_value">https%3A%2F%2F${spAcsHost}%2Fshibboleth</stringProp> 
						</elementProp> 
						<elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						  <stringProp name="Argument.metadata">=</stringProp> 
						  <stringProp name="Argument.value">1148374557</stringProp> 
						  <boolProp name="HTTPArgument.use_equals">true</boolProp> 
						  <stringProp name="Argument.name">time</stringProp> 
						  <stringProp name="HTTPArgument.always_encode">true</stringProp> 
						  <stringProp name="HTTPArgument.encoded_name">time</stringProp> 
						  <stringProp name="HTTPArgument.encoded_value">1148374557</stringProp> 
						</elementProp> 
					 </collectionProp> 
					 <stringProp name="TestElement.name">Argument List</stringProp> 
					 <boolProp name="TestElement.enabled">true</boolProp> 
				  </elementProp> 
				  <stringProp name="HTTPSampler.mimetype"></stringProp> 
				  <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>

				  <stringProp name="HTTPSampler.FILE_FIELD"></stringProp> 
				  <stringProp name="TestElement.name">/idp/SSO</stringProp> 
				  <stringProp name="HTTPSampler.monitor">false</stringProp> 
				  <stringProp name="HTTPSampler.domain">${idpHost}</stringProp> 
				  <stringProp name="HTTPSampler.FILE_NAME"></stringProp> 
				  <boolProp name="HTTPSampler.auto_redirects">false</boolProp> 
				</HTTPSampler> 
				<hashTree> 
				  <RegexExtractor> 
					 <stringProp name="RegexExtractor.default">SAMLResponseEmpty</stringProp> 
					 <stringProp name="TestElement.gui_class">org.apache.jmeter.extractor.gui.RegexExtractorGui</stringProp> 
					 <stringProp name="TestElement.test_class">org.apache.jmeter.extractor.RegexExtractor</stringProp> 
					 <stringProp name="RegexExtractor.regex">"SAMLResponse" value="([a-zA-Z0-9\r\n\+\-=]*)"</stringProp>

					 <stringProp name="TestElement.name">SAML Response Extractor</stringProp> 
					 <boolProp name="TestElement.enabled">true</boolProp> 
					 <stringProp name="RegexExtractor.useHeaders">false</stringProp> 
					 <stringProp name="RegexExtractor.match_number">1</stringProp> 
					 <stringProp name="RegexExtractor.template">$1$</stringProp> 
					 <stringProp name="RegexExtractor.refname">SAMLResponse</stringProp> 
				  </RegexExtractor> 
				  <hashTree/> 
				</hashTree> 
			 </hashTree> 
			 <HTTPSampler> 
				<stringProp name="HTTPSampler.path">/Shibboleth.sso/SAML/POST</stringProp> 
				<stringProp name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp> 
				<stringProp name="HTTPSampler.method">POST</stringProp> 
				<boolProp name="HTTPSampler.use_keepalive">true</boolProp> 
				<stringProp name="HTTPSampler.protocol">http</stringProp> 
				<boolProp name="TestElement.enabled">true</boolProp> 
				<boolProp name="HTTPSampler.follow_redirects">true</boolProp> 
				<stringProp name="HTTPSampler.port">${spAcsPort}</stringProp> 
				<elementProp name="HTTPsampler.Arguments" elementType="org.apache.jmeter.config.Arguments"> 
				  <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>

				  <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp> 
				  <collectionProp name="Arguments.arguments"> 
					 <elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						<stringProp name="Argument.metadata">=</stringProp> 
						<stringProp name="Argument.value">cookie</stringProp> 
						<boolProp name="HTTPArgument.use_equals">true</boolProp> 
						<stringProp name="Argument.name">TARGET</stringProp> 
						<boolProp name="HTTPArgument.always_encode">true</boolProp> 
						<stringProp name="HTTPArgument.encoded_name">TARGET</stringProp> 
						<stringProp name="HTTPArgument.encoded_value">cookie</stringProp> 
					 </elementProp> 
					 <elementProp name="" elementType="org.apache.jmeter.protocol.http.util.HTTPArgument"> 
						<stringProp name="Argument.metadata">=</stringProp> 
						<stringProp name="Argument.value">${SAMLResponse}</stringProp> 
						<boolProp name="HTTPArgument.use_equals">true</boolProp> 
						<stringProp name="Argument.name">SAMLResponse</stringProp> 
						<boolProp name="HTTPArgument.always_encode">true</boolProp> 
					 </elementProp> 
				  </collectionProp> 
				  <stringProp name="TestElement.name">Argument List</stringProp> 
				  <boolProp name="TestElement.enabled">true</boolProp> 
				</elementProp> 
				<stringProp name="HTTPSampler.mimetype"></stringProp> 
				<stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>

				<stringProp name="HTTPSampler.FILE_FIELD"></stringProp> 
				<stringProp name="TestElement.name">/Shibboleth.sso/SAML/POST</stringProp> 
				<stringProp name="HTTPSampler.monitor">false</stringProp> 
				<stringProp name="HTTPSampler.domain">${spAcsHost}</stringProp> 
				<stringProp name="HTTPSampler.FILE_NAME"></stringProp> 
				<boolProp name="HTTPSampler.auto_redirects">false</boolProp> 
			 </HTTPSampler> 
			 <hashTree/> 
		  </hashTree> 
		</hashTree> 
	 </hashTree> 
  </hashTree> 
</jmeterTestPlan>