You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "justinmclean (via GitHub)" <gi...@apache.org> on 2025/08/12 05:28:01 UTC

[I] [Improvement] Correct credential lookup logic in SupportsCredentials.java [gravitino]

justinmclean opened a new issue, #8033:
URL: https://github.com/apache/gravitino/issues/8033

   ### What would you like to be improved?
   
   In  api/src/main/java/org/apache/gravitino/credential/SupportsCredentials.java SupportsCredentials#getCredential should only flag duplicates among credentials of the requested type, avoiding false positives when multiple credential types exist.
   
   Here is some test code that should help explain the issue:
   ```
   public class TestSupportsCredentials {
   
     static class DummyCredential implements Credential {
       private final String type;
       DummyCredential(String type) { this.type = type; }
       @Override
       public String credentialType() { return type; }
       @Override
       public long expireTimeInMs() { return 0; }
       @Override
       public Map<String, String> credentialInfo() { return ImmutableMap.of(); }
       @Override
       public void initialize(Map<String, String> credentialInfo, long expireTimeInMs) {}
     }
   
     static class DummySupports implements SupportsCredentials {
       private final Credential[] credentials;
       DummySupports(Credential... credentials) { this.credentials = credentials; }
       @Override
       public Credential[] getCredentials() { return credentials; }
     }
   
     @Test
     public void testGetCredentialReturnsMatchingCredential() throws Exception {
       Credential c1 = new DummyCredential("typeA");
       Credential c2 = new DummyCredential("typeB");
       SupportsCredentials sc = new DummySupports(c1, c2);
       Assertions.assertEquals(c1, sc.getCredential("typeA"));
     }
   
     @Test
     public void testGetCredentialThrowsWhenMultipleSameType() {
       Credential c1 = new DummyCredential("typeA");
       Credential c2 = new DummyCredential("typeA");
       SupportsCredentials sc = new DummySupports(c1, c2);
       Assertions.assertThrows(IllegalStateException.class, () -> sc.getCredential("typeA"));
     }
   }
   ```
   
   ### How should we improve?
   
   check the filteredCredentials length not the credential length.


-- 
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: commits-unsubscribe@gravitino.apache.org.apache.org

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


Re: [I] [Improvement] Correct credential lookup logic in SupportsCredentials.java [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on issue #8033:
URL: https://github.com/apache/gravitino/issues/8033#issuecomment-3178260724

   All yours


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [I] [Improvement] Correct credential lookup logic in SupportsCredentials.java [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean closed issue #8033: [Improvement] Correct credential lookup logic in SupportsCredentials.java
URL: https://github.com/apache/gravitino/issues/8033


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [I] [Improvement] Correct credential lookup logic in SupportsCredentials.java [gravitino]

Posted by "ankamde (via GitHub)" <gi...@apache.org>.
ankamde commented on issue #8033:
URL: https://github.com/apache/gravitino/issues/8033#issuecomment-3178250446

   @justinmclean I would like to work on this issue. Please assign it to me.


-- 
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: commits-unsubscribe@gravitino.apache.org

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