You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/03/18 07:10:54 UTC

[GitHub] [cassandra] bereng commented on a change in pull request #1478: CASSANDRA-17334 Pre hashed passwords in CQL for trunk

bereng commented on a change in pull request #1478:
URL: https://github.com/apache/cassandra/pull/1478#discussion_r829740701



##########
File path: src/java/org/apache/cassandra/auth/CassandraRoleManager.java
##########
@@ -172,14 +172,14 @@ protected final void loadRoleStatement()
     public void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options)
     throws RequestValidationException, RequestExecutionException
     {
-        String insertCql = options.getPassword().isPresent()
+        String insertCql = options.getPassword().isPresent() || options.getHashedPassword().isPresent()
                          ? String.format("INSERT INTO %s.%s (role, is_superuser, can_login, salted_hash) VALUES ('%s', %s, %s, '%s')",
                                          SchemaConstants.AUTH_KEYSPACE_NAME,
                                          AuthKeyspace.ROLES,
                                          escape(role.getRoleName()),
                                          options.getSuperuser().or(false),
                                          options.getLogin().or(false),
-                                         escape(hashpw(options.getPassword().get())))
+                                         options.getHashedPassword().or(() -> escape(hashpw(options.getPassword().get()))))

Review comment:
       sgtm




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org