This is an automated email from the ASF dual-hosted git repository.
ethanli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git
The following commit(s) were added to refs/heads/master by this push:
new 078332a [STORM-3578] ClientAuthUtils.insertWorkerTokens removed
tokens incorrectly
new 1b2ff39 Merge pull request #3206 from Ethanlm/STORM-3577
078332a is described below
commit 078332a6670c852164fea166d84304627173feba
Author: Ethan Li <[email protected]>
AuthorDate: Fri Feb 7 11:23:24 2020 -0600
[STORM-3578] ClientAuthUtils.insertWorkerTokens removed tokens incorrectly
---
.../org/apache/storm/security/auth/ClientAuthUtils.java | 14 +++++++++++---
.../org/apache/storm/security/auth/kerberos/AutoTGT.java | 1 +
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git
a/storm-client/src/jvm/org/apache/storm/security/auth/ClientAuthUtils.java
b/storm-client/src/jvm/org/apache/storm/security/auth/ClientAuthUtils.java
index 6a9b703..3db487d 100644
--- a/storm-client/src/jvm/org/apache/storm/security/auth/ClientAuthUtils.java
+++ b/storm-client/src/jvm/org/apache/storm/security/auth/ClientAuthUtils.java
@@ -409,9 +409,17 @@ public class ClientAuthUtils {
Set<Object> creds = subject.getPrivateCredentials();
synchronized (creds) {
WorkerToken previous = findWorkerToken(subject, type);
- creds.add(token);
- if (previous != null) {
- creds.remove(previous);
+ boolean notAlreadyContained = creds.add(token);
+ if (notAlreadyContained) {
+ if (previous != null) {
+ //this means token is not equal to previous so we
should remove previous
+ creds.remove(previous);
+ LOG.info("Replaced WorkerToken for service type
{}", type);
+ } else {
+ LOG.info("Added new WorkerToken for service type
{}", type);
+ }
+ } else {
+ LOG.info("The new WorkerToken for service type {} is
the same as the previous token", type);
}
}
}
diff --git
a/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java
b/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java
index 6936555..668d4b3 100644
--- a/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java
+++ b/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java
@@ -172,6 +172,7 @@ public class AutoTGT implements IAutoCredentials,
ICredentialsRenewer, IMetricsR
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
private void populateSubjectWithTGT(Subject subject, Map<String, String>
credentials) {
+ LOG.info("Populating TGT from credentials");
KerberosTicket tgt = getTGT(credentials);
if (tgt != null) {
clearCredentials(subject, tgt);