Hey.
Sorry. Think brain wasn't 100% online when I posted this. Here's what I 
ended-up with:

class Utils {
   static final def downloadBytesWithKeyStore = { url, keystore, pass ->
        downloadBytes url, { HttpURLConnection connection ->
            if (connection instanceof HttpsURLConnection) {
                def helper = new SelfSignedCertificateHelper(getClass().
getResource(keystore), pass)
                helper.acceptCertificatesFor(connection as 
HttpsURLConnection)
            }
        }
    }
}

class BaseSpec extends GebReportingSpec {
    static final def DFL_KS_PASS = 'password', DFL_KS = "keystore.jks"

    def downloadUrl(url,jks = DFL_KS, pass = DFL_KS_PASS) {
        Utils.downloadBytesWithKeyStore.delegate = page
        Utils.downloadBytesWithKeyStore url, jks, pass
    }
}

class MySpec {
    def "test foo"() {
        //...
        downloadUrl 'files/foo/bar'
        //...
    }
}

Cheers,
Sam

On Tuesday, October 10, 2017 at 4:20:00 AM UTC+11, Marcin Erdmann wrote:
>
> Sam,
>
> Can you please explain what you mean by "pass the certificate's resource 
> name & password as arguments to the closure"? I had a look at the snippet 
> you linked to and I don't quite get what you are trying to achieve and 
> where you you want pass the data from.
>
> Marcin
>
> On Mon, Oct 9, 2017 at 2:32 AM, Samuel Rossinovic <[email protected] 
> <javascript:>> wrote:
>
>> Hi.
>>
>> Re 
>> http://www.gebish.org/manual/current/#dealing-with-untrusted-certificates
>>
>> Would appreciate a suggestion how to pass the certificate's resource name 
>> & password as arguments to the closure. Can this be done?
>>
>> Thanks!
>> Sam
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Geb User Mailing List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/geb-user/c57e23bc-b523-4e6f-8d40-41a391a69307%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/geb-user/c57e23bc-b523-4e6f-8d40-41a391a69307%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/47d7a28e-5459-4dad-b647-79817c2cc1bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to