Skip to content

Instantly share code, notes, and snippets.

View enakamura3's full-sized avatar
🤔

Edson Nakamura enakamura3

🤔
  • São Paulo, Brazil
  • 02:11 (UTC -03:00)
View GitHub Profile
@js1972
js1972 / basic_auth_check.groovy
Created May 1, 2014 08:41
Basic Auth check in groovy for SoapUI. When using a SOAP Mock in SoapUI there is no standard way to check the authentication provided by the caller. This script can be added to your mock in the "OnRequest Script" section and allows you to check for the correct credentials. If you test this from SoapUI as well then you need to set the Authenticat…
import com.eviware.soapui.support.types.StringToStringsMap
def authSucceeded = false
// get the request headers
StringToStringsMap headers = mockRequest.getRequestHeaders()
headers.each {
if (it.key.equals("Authorization")) {
String content = it.value
String[] contentArray = content.split()