pan3793 commented on code in PR #7550: URL: https://github.com/apache/kyuubi/pull/7550#discussion_r3549204941
########## kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/auth/SubjectUtil.java: ########## @@ -0,0 +1,302 @@ +/* + * 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.kyuubi.jdbc.hive.auth; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.Objects; +import java.util.concurrent.Callable; +import java.util.concurrent.CompletionException; +import javax.security.auth.Subject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Utility class that adapts Security Manager APIs across JDK versions (8 through 25+). + * + * <p>In JDK 17 the Security Manager and related APIs were deprecated for removal (JEP 411). In JDK + * 24 the Security Manager was permanently disabled (JEP 486). This class bridges {@code + * Subject.getSubject()}, {@code Subject.doAs()}, and {@code AccessController.getContext()} to their + * JDK 18+ replacements ({@code Subject.current()} and {@code Subject.callAs()}) using {@code + * MethodHandle} lookups resolved once at class load time. + * + * <p>Derived from Apache Hadoop's {@code SubjectUtil}, which is itself derived from Apache Calcite + * Avatica and the Jetty implementation. + */ Review Comment: let's mention the version reference. It will likely receive no change until Hadoop 3.5.1 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
