Skip to content

Commit e024401

Browse files
committed
[FLINK-21700][security] Set service name as credential alias
1 parent b353c7d commit e024401

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.apache.hadoop.fs.FileSystem;
3535
import org.apache.hadoop.fs.Path;
3636
import org.apache.hadoop.io.DataOutputBuffer;
37-
import org.apache.hadoop.io.Text;
3837
import org.apache.hadoop.mapreduce.security.TokenCache;
3938
import org.apache.hadoop.security.Credentials;
4039
import org.apache.hadoop.security.UserGroupInformation;
@@ -217,9 +216,8 @@ public static void setTokensFor(
217216

218217
Collection<Token<? extends TokenIdentifier>> usrTok = currUsr.getTokens();
219218
for (Token<? extends TokenIdentifier> token : usrTok) {
220-
final Text id = new Text(token.getIdentifier());
221-
LOG.info("Adding user token " + id + " with " + token);
222-
credentials.addToken(id, token);
219+
LOG.info("Adding user token " + token.getService() + " with " + token);
220+
credentials.addToken(token.getService(), token);
223221
}
224222
try (DataOutputBuffer dob = new DataOutputBuffer()) {
225223
credentials.writeTokenStorageToStream(dob);
@@ -568,8 +566,7 @@ static ContainerLaunchContext createTaskExecutorContext(
568566
Collection<Token<? extends TokenIdentifier>> userTokens = cred.getAllTokens();
569567
for (Token<? extends TokenIdentifier> token : userTokens) {
570568
if (!token.getKind().equals(AMRMTokenIdentifier.KIND_NAME)) {
571-
final Text id = new Text(token.getIdentifier());
572-
taskManagerCred.addToken(id, token);
569+
taskManagerCred.addToken(token.getService(), token);
573570
}
574571
}
575572

0 commit comments

Comments
 (0)