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

feat(auth): support custom scheme of http auth #3568

Open
3 tasks done
Tracked by #3994
archerzz opened this issue Jun 12, 2024 · 0 comments
Open
3 tasks done
Tracked by #3994

feat(auth): support custom scheme of http auth #3568

archerzz opened this issue Jun 12, 2024 · 0 comments
Labels
design:needed A design request has been raised that needs a proposal lib:http triaged:core
Milestone

Comments

@archerzz
Copy link
Member

Clear and concise description of the problem

See cadl-ranch test case: https://github.com/Azure/cadl-ranch/blob/2fb006d5b4609647138382bf5d248a2edbde7742/packages/cadl-ranch-specs/http/authentication/http/custom/main.tsp#L10

scheme: "SharedAccessKey"

However, currently for auth of type: "http", we only explicitly support scheme of basic or bearer:

export interface BasicAuth extends HttpAuthBase {
type: "http";
scheme: "basic";
}
/**
* Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens.
* The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request.
* The client must send this token in the Authorization header when making requests to protected resources:
* ```
* Authorization: Bearer <token>
* ```
*/
export interface BearerAuth extends HttpAuthBase {
type: "http";
scheme: "bearer";
}

Downstream codes can actually support custom scheme, but the type is "never".
https://github.com/Azure/autorest.csharp/blob/0018fa9139bc21d79a258f67c1f981aaa3852b24/src/TypeSpec.Extension/Emitter.Csharp/src/lib/service-authentication.ts#L34-L49
image

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design:needed A design request has been raised that needs a proposal lib:http triaged:core
Projects
None yet
Development

No branches or pull requests

2 participants