This might cross the line into full-blown crazy, but what about
authenticating using curl and just nicking the session cookie?:

  #!/bin/bash

  # ugh.
  user="$1"
  pass="$2"
  url="$3"
  path="$4"
  out="$5"

  session=$(curl -s --cookie-jar - -H "Referer: ${url}/dev" \
      -F'sakaiauth:login=1' \
      -F"sakaiauth:un=$user" \
      -F"sakaiauth:pw=$pass" \
      "$url/system/sling/formlogin" 2>&1 \
      | grep sakai-trusted-authn | awk '{print $7}')

  wkhtmltopdf-amd64 --cookie 'sakai-trusted-authn' "$session" --use-xserver 
--no-stop-slow-scripts --javascript-delay 5000 "${url}${path}" "$out"


Running that with:

  ./script.sh admin admin 'http://localhost:8080' '/' oae.pdf

seems to indicate I've been successfully logged in...

Cheers,

Mark


"Arno Declercq" <[email protected]> writes:

> Erik,
> Yes, I tried that already but unfortunately that doesn't seem to work.
> So I'm looking for another way to set credentials. Thanks for your reply
> though.
>
>> Arno,
>> It looks like wkhtmltopdf  supports authentication with the --username
>> and --password flags.
>> http://www.linuxcertif.com/man/1/wkhtmltopdf/
>>
>> Erik
>>
>> On Wed, Apr 18, 2012 at 1:20 PM, Arno Declercq <[email protected]>
>> wrote:
>>> Hi,
>>>
>>> I'm working on a Sakai document to PDF converter and I'm using
>>> wkhtmltopdf
>>> to do this. I'm running this from preview_processor.rb. It works if the
>>> document is public but I can't access it if it's private.
>>> My question is:
>>> How can I set credentials to grant wkhtmltopdf access to those pages?
>>>
>>> Thank you in advance.

-- 
Mark Triggs
<[email protected]>
_______________________________________________
oae-dev mailing list
[email protected]
http://collab.sakaiproject.org/mailman/listinfo/oae-dev

Reply via email to