ChrisLively
ChrisLively

Reputation: 88092

Html to PDF and security

We have a web app that is using forms security.

One of the options includes the ability to print an html page to PDF. We're currently evaluating different products like PdfMetamorphosis, but I believe all of them will have this issue.

The client makes a request for the pdf by clicking a link button. The code for the button instantiates the PDF builder and passes it a url to convert. However, the URL is behind our forms authentication. Which means that the resulting PDF is nothing but a login page.

Unfortunately, we need the user information in order to verify acccess to the printed page (among other reasons). Which means I can't just allow access to everyone to that folder.

So I need one of three possible solutions.

1) I need a way to give the PdfMetamorphosis component the authorization ticket to pass on in it's request.
2) I need an html to pdf component that will do this.
3) Something else?

I don't think the first one is possible and I haven't been able to find a html to pdf component that takes this into consideration.

Ideas?

Upvotes: 1

Views: 247

Answers (1)

Simon Mourier
Simon Mourier

Reputation: 139296

You can try to pass login information in the url passed to the builder. That means your forms auth page would need to support that, of course.

Now, since the Forms Auth login probably uses cookies, you will have to check the PDF Builder supports cookies when it gets the document from the url.

If it doesn't, then you'll have to write some kind of frontend class that will load the document from the url, supporting Forms Auth cookies, and passes it as a file or a stream to the PDF Builder for final processing.

Upvotes: 1

Related Questions