elastic/kibana

Allow edit of `redirectURL` and `authResponseHeaders` on `AuthenticationResult` objects after creation

Open

#144,698 opened on Nov 7, 2022

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (19,065 stars) (8,021 forks)batch import
Feature:Security/AuthenticationTeam:Securitygood first issuetechnical debt

Description

In a few locations we've had the need to edit either the redirectURL or the authResponseHeaders of an already created AuthenticationResult object. These properties are read-only and so we currently resort to simply create a new AuthenticationResult object with the changes. This leads to fairly verbose code and can lead to errors if we forget to copy all fields. So it would be better to allow these fields to be edited post-creation.

Example of how this is done today:

https://github.com/elastic/kibana/blob/a7976e57aaf5d59cbf3cd8f017104155f42de832/x-pack/plugins/security/server/authentication/authenticator.ts#L428-L440

Contributor guide