You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/07/23 14:16:38 UTC

[GitHub] [nifi] bbende commented on a change in pull request #4416: NIFI-7568 - Ensure Kerberos mappings are applied correctly

bbende commented on a change in pull request #4416:
URL: https://github.com/apache/nifi/pull/4416#discussion_r459480827



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/service/impl/StandardKeyService.java
##########
@@ -118,11 +118,20 @@ public void deleteKey(String identity) {
             transaction = transactionBuilder.start();
 
             // delete the keys
-            DeleteKeysAction deleteKeys = new DeleteKeysAction(identity);
-            transaction.execute(deleteKeys);
-
-            // commit the transaction
-            transaction.commit();
+            DeleteKeyAction deleteKey = new DeleteKeyAction(keyId);
+            Integer rowsDeleted = transaction.execute(deleteKey);
+
+            // commit the transaction if we found one and only one matching user identity
+
+            if (rowsDeleted == 0) {
+                rollback(transaction);
+                throw new AdministrationException("Unable to find user key for key ID " + keyId + " to remove token.");
+            } else if (rowsDeleted > 1) {

Review comment:
       The key table has the following schema:
   ```
   CREATE TABLE KEY (
    ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, 
    IDENTITY VARCHAR2(4096) NOT NULL UNIQUE, 
    KEY VARCHAR2(100) NOT NULL"
   )
   ```
   Does `keyId` here refer to the `ID` column in this table?
   
   If so, then there could never be multiple rows with the same ID since that column is the primary key of the table.




----------------------------------------------------------------
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.

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