swagger-api / swagger-api/swagger-ui
add an option in oauth2-redirect.html to use the HTTP Basic authentication scheme for the client secret
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
As recommended in RFC, client secret should be transmitted using Basic authentication. Using swagger-ui with an oauth2 server that only supports this security scheme for client authentication returns an error.
Using OAuth2 with the authorization code grant type, the request sent by swagger ui using oauth2-redirect.html is as follow:
POST /token HTTP/1.1
Host: localhost:8090
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=XXXXXX&client_id=YYYYYY&client_secret=ZZZZZZ&redirect_uri=http%3A%2F%2Flocalhost%3A8091%2Foauth2-redirect.html
I would like to have the possibility to force the Basic auth in the oauth2-redirect.html:
POST /token HTTP/1.1
Host: localhost:8090
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=XXXXXX&redirect_uri=http%3A%2F%2Flocalhost%3A8091%2Foauth2-redirect.html
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading oauth2-redirect.html and trace how the authorization-code token request is assembled. Add an option that sends the client credentials with HTTP Basic authentication instead of including them in the form body, then verify that the generated request matches the requested Authorization header and omits the client secret form field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- authentication
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100