microsoft / microsoft/typespec

feat(auth): support custom scheme of `http` auth

Open
#3,568 0 comments 1 reaction 0 assignees View on GitHub
design:needed lib:http triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

### 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`: https://github.com/microsoft/typespec/blob/1f82d65ea04134d7182158cf3cc98158b6923f87/packages/http/src/types.ts#L68-L84

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](https://github.com/microsoft/typespec/assets/4516/0c716a20-5fca-4a18-83a0-c84ff6025406)

### Checklist

- [X] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [docs](https://typespec.io/docs/).
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.