Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

EvoPDF in Azure to print authenticated Page #8785


User avatar
0
ignasiclos created

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)
  • User Avatar
    0
    ismcagdas created
    Support Team

    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) or AbpAllowAnonymous on your AppService (or one of its methods).

  • User Avatar
    0
    ignasiclos created

    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.

  • User Avatar
    0
    ismcagdas created
    Support Team

    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 ?

  • User Avatar
    0
    ignasiclos created

    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