Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcelink Private Files Authenticiation #391

Closed
Romanx opened this issue Oct 2, 2020 · 7 comments
Closed

Sourcelink Private Files Authenticiation #391

Romanx opened this issue Oct 2, 2020 · 7 comments

Comments

@Romanx
Copy link

Romanx commented Oct 2, 2020

When processing coverage files generated with a source-linked source the files are identified as urls which reportgenerator which when processing is loaded here.

If the url is protected, such as an azure devops private repository the request gets a 401 and thus the report doesn't work correctly. Would it be posible to provide a mechnism to provide authorization to the request?

To Reproduce
The following input helps to reproduce your issue:

  1. Have a coverage report including a sourcelinked file url that behind authorization.
  2. Run report-generator and you will recieve some errors/warnings that the request was 401'd
@danielpalme
Copy link
Owner

How would authentication work in your case?

  • Cookie
  • Token (via header or query string)
  • something else

@Romanx
Copy link
Author

Romanx commented Oct 5, 2020

In our case we're using Azure-devops and running report generator in the agent so providing the agent authentication token via the header would by the perfect case but something that could be used by anyone needing access to private files when running report generator would be great.

I'd be happy to help write it once we have an idea of what would be best.

@danielpalme
Copy link
Owner

Adding a custom header should be easy.
I will have a look within the next days.

@danielpalme
Copy link
Owner

In release 4.7.0 I added a new setting customHeadersForRemoteFiles.
With this setting, you can add custom headers to all remote requests.

You just have to add another command line parameter. E.g.:
"settings:customHeadersForRemoteFiles=Authorization=Bearer <JWT>"

It is also possible to add several headers. E.g.:
"settings:customHeadersForRemoteFiles=key1=value1;key2=value2"

See also: https://github.com/danielpalme/ReportGenerator/wiki/Settings

The new release is published through Azure DevOps. It may take some time until this process has finished (they have some problems at the moment).

@Romanx
Copy link
Author

Romanx commented Oct 7, 2020

@danielpalme Thank you very much for the quick addition and for a great project!

@Romanx Romanx closed this as completed Oct 7, 2020
@danielpalme
Copy link
Owner

Release 4.7.0 is now available.
Please let me know if this new feature works for you.

@Romanx
Copy link
Author

Romanx commented Nov 6, 2020

@danielpalme Sorry for the delay in replying, this worked perfectly for our use case. Thank you for the quick turn around on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants