Hello,
We're using EVOPdf library to print html to pdf.
As EvoPDF can't run in Azure in the app itself, it has to run in a separated worker. The problem is that I've to print a page inside the aspnetzero app where the user has to be authenticated.
Could I somehow take the current access token and set it to the request made by the pdf engine.? If not, I'm thinking of creating a single use token to pass to the url, so the authentication is skipped, but seems a bit tricky.
On the other hand, can I have some public pages inside the authenticated app?
Any idea? Thanks
4 Answer(s)
-
0
Hi,
Yes, you can send the token as shown in the examples below;
For JQuery projects: https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Infrastructure-Core-Mvc-Token-Based-Authentication For Angular projects: https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Features-Angular-Token-Based-Authentication
On the other hand, can I have some public pages inside the authenticated app?
Yes, you can just use
AllowAnonymous
attribute on your Controller (or one of its Actions) orAbpAllowAnonymous
on your AppService (or one of its methods). -
0
Thanks, not sure if this solves my problem.
I don't need to access a controller anonymously, but be able to access a view of the application without beign authenticated. I mean, the pdf printer engine need as a parameter the url of the page to be printed, and because this is a background process I cannot authenticate it.
-
0
Hi @ignasiclos,
To access a view, you must access an action of a Controller. I don't know EVOPdf but does it provide a way for authentication ?
-
0
Hi @ismcagdas,
EvoPdf offers some ways of authentication, but not with token. I've made it by creating creating routes without guard in the angular application, an protecting them with a single use token, included in the url to print by the pdf engine.
Thanks