I hope this doesn't mean the preview processor now depends on bash and curl... You should be able to do something similar in native ruby, you should be able to get the cookies from the existing sling instance like:
@s.instance_variable_get("@cookies")
On Thu, Apr 19, 2012 at 12:44:34PM +0100, Nicolaas Matthijs wrote:
> That's awesome. I think that's exactly what we needed.
>
> Thanks,
> Nicolaas
>
>
> On 19 Apr 2012, at 12:26, Mark Triggs wrote:
>
> > 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
>
> _______________________________________________
> oae-dev mailing list
> [email protected]
> http://collab.sakaiproject.org/mailman/listinfo/oae-dev
--
D. Stuart Freeman
Georgia Institute of Technology
signature.asc
Description: Digital signature
_______________________________________________ oae-dev mailing list [email protected] http://collab.sakaiproject.org/mailman/listinfo/oae-dev
