question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow customizing httpBearerAuth scheme

See original GitHub issue

I’d like to model a service that uses what is effectively the HTTP Bearer authentication mechanism but with a different scheme. Would it be possible to extend the httpBearerAuth trait to support this?

I’m thinking something like this:

@httpBearerAuth(scheme="ApiKey")

which would result in HTTP requests with an Authorization: ApiKey {key} header. Existing services or services that use the Bearer scheme would continue to use @httpBearerAuth without the parameter – I’m hoping that’s possible but am still new to the Smithy syntax.

Is this possible? Is it a bad idea? Is there a better way to accomplish this? I think the alternative is to create a new @authDefinition that does the right thing, but I don’t particularly want to reinvent all of the surrounding codegen ecosystem just to change from Bearer to ApiKey. On a related note, I recognize that existing codegen would need to be updated to support this, where would I go to learn more?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidOgunsAWScommented, Aug 18, 2021

@glb Have a look at that pull request. I think it enables your use-case

0reactions
glbcommented, Oct 12, 2021

Thanks @mtdowling !

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use bearer authentication in openapi-codegen ...
What do I have to do to use the Bearer authentication scheme in the generated ... Could you please post this as an...
Read more >
HTTP authentication - MDN Web Docs - Mozilla
The "Basic" HTTP authentication scheme is defined in RFC 7617, which transmits credentials as user ID/password pairs, encoded using base64.
Read more >
Bearer Authentication - Swagger
Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens.
Read more >
Securing Azure Functions Endpoints via OpenAPI Auth
Let's use the Basic auth token this time. Set the property values of OpenApiSecurityAttribute(...) (line #6-8). Type : SecuritySchemeType.
Read more >
CircleCI's self-hosted runner API
The token can be provided using the Basic scheme, where username should be ... This allows the endpoint to be accessible on circleci.com/api/v2/runner...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found