Skip to content
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

Drop username from AuthenticateRequest #88365

Conversation

ywangd
Copy link
Member

@ywangd ywangd commented Jul 8, 2022

Since transport client is no longer supported for 8.x, the username field
in AuthenticateRequest is not useful at all. At REST layer, the API
never requires passing the username. Authentication should always be
performed for the current authenticating/effective subject. This logic
does not need to depend on the username. This PR drops the username
field and makes the Request class a singleton.

Relates: #88335

Since transport client is no longer support for 8.x, the username field
in AuthenticateRequest is not useful at all. At REST layer, the API
never requires passing the username. Authentication should always be
performed for the current authenticating/effective subject. This logic
does not need to depend on the username. This PR drops the username
field and makes the Request class a singleton.

Relates: elastic#88335
@ywangd ywangd added >refactoring :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v8.4.0 labels Jul 8, 2022
@ywangd ywangd requested a review from tvernum July 8, 2022 08:01
@elasticmachine elasticmachine added the Team:Security Meta label for security team label Jul 8, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

Comment on lines 39 to 41
if (out.getVersion().before(Version.V_8_4_0)) {
throw new IllegalStateException("cannot send authenticate request to a node of earlier version");
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing exception here since it is better to fail explicitly than guessing. But in practice this will never happen because AuthenticateRequest does not get sent across nodes.

@elasticsearchmachine elasticsearchmachine changed the base branch from master to main July 22, 2022 23:05
@mark-vieira mark-vieira added v8.5.0 and removed v8.4.0 labels Jul 27, 2022
Copy link
Contributor

@tvernum tvernum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ywangd ywangd added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Aug 12, 2022
@elasticsearchmachine elasticsearchmachine merged commit 5a19729 into elastic:main Aug 12, 2022
@ywangd ywangd deleted the drop-username-from-authenticate-request branch August 12, 2022 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >refactoring :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants