MetaCell / MetaCell/cloud-harness
Fastapi generated api do not get authentication parameters from Cookie
- Dominant language
- Python
- Stars
- 19
- Forks
- 5
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 3
Description
The generated function supports the bearer token but not cookie.
```
@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
# retrieve the bearer token from the header
# and save it for use in the AuthClient
authorization = request.headers.get('Authorization')
if authorization:
set_authentication_token(authorization)
return await call_next(request)
```
The cookie authentication is handy when the application is secured by a gatekeeper, as it comes for free on every request.
It's also ignoring the parameter coming from the spec, like in
```
securitySchemes:
bearerAuth:
scheme: bearer
bearerFormat: JWT
type: http
x-bearerInfoFunc: cloudharness.auth.decode_token
cookieAuth:
type: apiKey
name: kc-access
in: cookie
x-apikeyInfoFunc: cloudharness.auth.decode_token
```
This is not necessarily required as we don't have different decode token handlers, but can be confusins as the Connexion apis require those instead
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the generated API authentication entry point and the middleware shown in the issue, then inspect how the bearer token is read. Compare that path with the cookieAuth and bearerAuth securitySchemes in the provided specification; done means cookie credentials are handled and the relevant specification parameters are honored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, authentication, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100