swagger-js icon indicating copy to clipboard operation
swagger-js copied to clipboard

Allowing user to set "AUTH_TOKEN" in env to download privately hosted schema as well

Open manzarul opened this issue 4 months ago • 0 comments

In certain use cases where OpenAPI specifications reference schemas hosted on private URLs, it's important to support authentication to allow access to these resources. I identified this section of code that resolves schema references. To enable seamless access to private URLs, I propose extending the functionality to include an Authorization header if a user sets an authentication token via an environment variable. This way, when the schema reference is hosted on a private server, users can authenticate by setting the auth token in their environment, allowing the private URL to be accessed.

Description

Allowing user to "AUTH_TOKEN" in env to download privately hosted schema as well.

Motivation and Context

Currently Editor can resolve only ref which is publicly available , but if we add this then it can allow to resolved authenticated url as well.

Not sure!

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • [ ] No code changes (changes to documentation, CI, metadata, etc)
  • [ ] Dependency changes (any modification to dependencies in package.json)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

manzarul avatar Oct 05 '24 07:10 manzarul