dmvk commented on a change in pull request #18664: URL: https://github.com/apache/flink/pull/18664#discussion_r837157185
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/security/token/NoOpDelegationTokenManager.java ########## @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.security.token; + +import org.apache.hadoop.security.Credentials; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** {@link DelegationTokenManager} implementation which does nothing. */ +public class NoOpDelegationTokenManager implements DelegationTokenManager { + + private static final Logger LOG = LoggerFactory.getLogger(NoOpDelegationTokenManager.class); + + public NoOpDelegationTokenManager() { + LOG.debug("NoOpDelegationTokenManager"); + } + + @Override + public void obtainDelegationTokens(Credentials credentials) { + LOG.debug("obtainDelegationTokens"); Review comment: Do we want to keep this debug messages? Personally I'd be in favor of removing them as this could cause a confusion when user enables the debug logging. ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/security/token/DelegationTokenConverterTest.java ########## @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.security.token; + +import org.apache.hadoop.io.Text; +import org.apache.hadoop.security.Credentials; +import org.apache.hadoop.security.token.Token; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** Test for {@link DelegationTokenConverter}. */ +public class DelegationTokenConverterTest { + + @Test Review comment: nit: community has agreed to use junit 5 + assertj for the newly added tests ########## File path: flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java ########## @@ -1090,9 +1095,17 @@ private ApplicationReport startAppMaster( final ContainerLaunchContext amContainer = setupApplicationMasterContainer(yarnClusterEntrypoint, hasKrb5, processSpec); - // setup security tokens + // Here we have the new and the old delegation token framework together temporarily. + // The reason is simple, adding a horror complicated several thousand lines PR is not a good + // idea so in the upcoming commits will remove the old DT framework and only the + // new will be in place. + Review comment: I'd remove this comment. If we want a note about this, I'd rather do something along the lines of: ``` // Old delegation token framework (to be removed in FLINK-XXX) ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/security/token/ExceptionThrowingDelegationTokenProvider.java ########## @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.security.token; + +import org.apache.flink.configuration.Configuration; + +import org.apache.hadoop.security.Credentials; + +import java.util.Optional; + +/** + * An example implementation of {@link DelegationTokenProvider} which throws exception when enabled. + */ +public class ExceptionThrowingDelegationTokenProvider implements DelegationTokenProvider { + + public static volatile boolean enabled = false; Review comment: Not a big fan of this approach as it's fairly fragile and the tests that are using the class can not be parallelized. 🤔 It's probably ok-ish as long as this is used only by a single test class. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
