Example of Login to SAML/Shibboleth authenticated site?

Anyone has been able to (programmatically) authenticate via SAML/Shibboleth from/with Julia? I’m successfully scraping information from a site but to get all the information I need they require single-sign on via a SAML/Shibboleth interface (yes, I have an account and can manually sign on via a web browser ;)). I’ve sniffed some of the HTTP requests involved but it is not clear to me how to correctly handle the cookies and encoding that is involved. If anyone has pointers or example code that would be great.

I found a workaround so sharing it here if someone else has a similar situation:

By “sniffing” the HTTP requests involved when I logged in manually I could see that after the whole authentication there was a single cookie used in the later calls to the main site I was accessing. If I copy and use only this cookie in my Julia HTTP.request calls I can access the content I’m after.

So just login manually, check last http requests (with, for example, HTTP Header Live plugin for Firefox) and find the cookie that is used after you have logged in. And then, in Julia change your HTTP.request calls to:

Cookie = "ezproxy=cookievaluehere" # Get the cookie name and value from your sniffed HTTP headers/requests during manual login
headers = [
    "Cookie" => Cookie
HTTP.request("GET", url, headers)

I guess this might not work for everyone since it depends on how the SAML/Shibboleth is setup. But maybe it helps someone.

1 Like