tsoa icon indicating copy to clipboard operation
tsoa copied to clipboard

Hapi authentication callback should include ResponseToolkit (h) object

Open wallacethefmh opened this issue 3 years ago • 5 comments

Sorting

  • I'm submitting a ...

    • [ ] bug report
    • [x] feature request
    • [ ] support request
  • I confirm that I

    • [x] used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

hapiAuthentication callback should also receive the hapi.ResponseToolkit (aka h) object.

Current Behavior

hapiAuthentication only gets the Request object

Possible Solution

export async function hapiAuthentication(
  request: Request,
  h: ResponseToolkit,
  securityName: string,
  _scopes?: string[],
)

Steps to Reproduce

N/A

Context (Environment)

N/A

Detailed Description

The hapiAuthentication callback should also receive the hapi.ResponseToolkit (aka h). It currently only has access to the hapi.Request object. h is useful for example when trying to avoid the terrible Boom library, with the ability to use Response.takeover(). There are probably other use cases as well

Breaking change?

Yes if implemented as I described above.

wallacethefmh avatar Apr 18 '22 19:04 wallacethefmh

Hello there wallacethefmh 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

github-actions[bot] avatar Apr 18 '22 19:04 github-actions[bot]

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar May 19 '22 00:05 github-actions[bot]

I'd be open to injecting this on demand

WoH avatar May 21 '22 17:05 WoH

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Jun 22 '22 00:06 github-actions[bot]

I would be interested in something similar to this for koa responses.

fage88 avatar Jan 03 '24 20:01 fage88