-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Tech debt/substitute legacy request #119888
Tech debt/substitute legacy request #119888
Conversation
private authHeadersCache = new WeakMap<LegacyRequest, AuthHeaders>(); | ||
public set = (request: KibanaRequest | LegacyRequest, headers: AuthHeaders) => { | ||
private authHeadersCache = new WeakMap<Request, AuthHeaders>(); | ||
public set = (request: KibanaRequest | Request, headers: AuthHeaders) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public set = (request: KibanaRequest | Request, headers: AuthHeaders) => { | |
public set = (request: KibanaRequest, headers: AuthHeaders) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstood the suggestion for replacing LegacyRequest
with Hapi.Request
as removing the type alias. Thanks for clarifying!
constructor(private readonly canBeAuthenticated: () => boolean) {} | ||
public set = (request: KibanaRequest | LegacyRequest, state: unknown) => { | ||
public set = (request: KibanaRequest | Request, state: unknown) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public set = (request: KibanaRequest | Request, state: unknown) => { | |
public set = (request: KibanaRequest, state: unknown) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to allow Hapi.Request
as the request param type for configuring the auth scheme. Since this is private and internal to Core during the server setup/start, I think it's 'safe' enough to allow a Hapi.Request
as well.
If we did want to revisit that, we'd need to do some more refactoring and confirm that changes would be ok with unauthorized Kibana access and other auth work-flows.
this.storage.set(ensureRawRequest(request), state); | ||
}; | ||
public get = <T = unknown>(request: KibanaRequest | LegacyRequest) => { | ||
public get = <T = unknown>(request: KibanaRequest | Request) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public get = <T = unknown>(request: KibanaRequest | Request) => { | |
public get = <T = unknown>(request: KibanaRequest) => { |
dfe45e0
to
1a6eccb
Compare
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
💔 Backport failedThe backport operation could not be completed due to the following error: The backport PRs will be merged automatically after passing CI. To backport manually run: |
Resolves #119867
This PR handles the remaining usages of
LegacyRequest
in core http by substitutingLegacyRequest
withHapi.Request
and removes the type from thehttp
interface.Checklist
Delete any items that are not applicable to this PR.
For maintainers