Skip to content

Commit

Permalink
MINOR: Remove unused CredentialProvider#updateCredentials (#18622)
Browse files Browse the repository at this point in the history
Reviewers: Chia-Ping Tsai <[email protected]>
  • Loading branch information
frankvicky authored and LoganZhuZzz committed Jan 20, 2025
1 parent 47bdf77 commit fc7aa2d
Showing 1 changed file with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
*/
package org.apache.kafka.security;

import org.apache.kafka.clients.admin.ScramMechanism;
import org.apache.kafka.common.security.authenticator.CredentialCache;
import org.apache.kafka.common.security.scram.ScramCredential;
import org.apache.kafka.common.security.scram.internals.ScramCredentialUtils;
import org.apache.kafka.common.security.scram.internals.ScramMechanism;
import org.apache.kafka.common.security.token.delegation.internals.DelegationTokenCache;

import java.util.Collection;
import java.util.Properties;

public class CredentialProvider {
public final DelegationTokenCache tokenCache;
Expand All @@ -34,22 +33,8 @@ public CredentialProvider(Collection<String> scramMechanisms, DelegationTokenCac
ScramCredentialUtils.createCache(credentialCache, scramMechanisms);
}

public void updateCredentials(String username, Properties config) {
for (ScramMechanism mechanism : ScramMechanism.values()) {
CredentialCache.Cache<ScramCredential> cache = credentialCache.cache(mechanism.mechanismName(), ScramCredential.class);
if (cache != null) {
String c = config.getProperty(mechanism.mechanismName());
if (c == null) {
cache.remove(username);
} else {
cache.put(username, ScramCredentialUtils.credentialFromString(c));
}
}
}
}

public void updateCredential(
org.apache.kafka.clients.admin.ScramMechanism mechanism,
ScramMechanism mechanism,
String name,
ScramCredential credential
) {
Expand All @@ -58,7 +43,7 @@ public void updateCredential(
}

public void removeCredentials(
org.apache.kafka.clients.admin.ScramMechanism mechanism,
ScramMechanism mechanism,
String name
) {
CredentialCache.Cache<ScramCredential> cache = credentialCache.cache(mechanism.mechanismName(), ScramCredential.class);
Expand Down

0 comments on commit fc7aa2d

Please sign in to comment.