Skip to content

[FEATURE] Pass authentication/authorization to $ref HTTP resolvers #1796

@fmvilas

Description

@fmvilas

Why do we need this improvement?

It is impossible to work with files that have $ref pointing to a URL that's not public. In large organizations, it's pretty common to rely on schema definitions in a Schema Registry server and a GitHub repo with common definitions. However, they usually require some sort of authentication. In most cases, a simple way to specify an HTTP authorization header should suffice.

How will this change help?

By providing a mechanism in the CLI to pass an HTTP authorization header, we'll be unblocking the users in large organizations, which in turn are AsyncAPI target users (AsyncAPI doesn't really make much sense in small companies).

Screenshots

No response

How could it be implemented/designed?

This improvement could be done in the form of a global config. Since secrets are often stored in environment variables, it would be great to add support for specifying which env var to read from.

Ideas:

# This makes all $refs pointing to any file in the myorg/myrepo repo to use the
# HTTP header Authorization: Bearer super-secret-here
asyncapi config auth add github.com/myorg/myrepo/**/*.* bearer super-secret-here

# This makes all $refs pointing to any file in the myorg/myrepo repo to use the
# HTTP header Authorization: Bearer {{$MY_TOKEN}}
asyncapi config auth add github.com/myorg/myrepo/**/*.* bearer $MY_TOKEN --env

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

None

Metadata

Metadata

Labels

bountyAsyncAPI Bounty program related labelenhancementNew feature or request

Type

No type

Projects

Status

Completed

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions