Browse Source

Pull request #4103: DEC-21348 revert: 回退java security适配

Merge in CORE/base-third from ~CLOUD.LIU/base-third:release/10.0 to release/10.0

* commit '063e6e14ff53184001ec8a994a7c95bfd9491033':
  Revert "DEC-21348 fix: java security适配"
release/10.0
Cloud.Liu 3 years ago
parent
commit
7c93f3306a
  1. 11
      fine-byte-buddy/src/main/java/com/fr/third/net/bytebuddy/dynamic/NexusAccessor.java

11
fine-byte-buddy/src/main/java/com/fr/third/net/bytebuddy/dynamic/NexusAccessor.java

@ -19,19 +19,20 @@ import com.fr.third.net.bytebuddy.build.HashCodeAndEqualsPlugin;
import com.fr.third.net.bytebuddy.description.method.MethodDescription;
import com.fr.third.net.bytebuddy.description.type.TypeDescription;
import com.fr.third.net.bytebuddy.dynamic.loading.ClassInjector;
import com.fr.third.net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
import com.fr.third.net.bytebuddy.implementation.Implementation;
import com.fr.third.net.bytebuddy.implementation.LoadedTypeInitializer;
import com.fr.third.net.bytebuddy.implementation.bytecode.ByteCodeAppender;
import com.fr.third.net.bytebuddy.implementation.bytecode.Removal;
import com.fr.third.net.bytebuddy.implementation.bytecode.StackManipulation;
import com.fr.third.net.bytebuddy.implementation.bytecode.member.MethodInvocation;
import com.fr.third.research.annotations.SuppressFBWarnings;
import com.fr.third.net.bytebuddy.implementation.bytecode.collection.ArrayFactory;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.ClassConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.IntegerConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.NullConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.TextConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.member.MethodInvocation;
import com.fr.third.org.objectweb.asm.MethodVisitor;
import com.fr.third.research.annotations.SuppressFBWarnings;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
@ -222,11 +223,7 @@ public class NexusAccessor {
return new Unavailable("Nexus injection was explicitly disabled");
} else {
try {
/*
* 实例化UsingReflection时要指定非null的ProtectionDomain否则开启-security后经由这里调用具体方法时会校验权限失败
* 这里指定为NexusAccessor的ProtectionDomain即fine-third jar
*/
Class<?> nexusType = new ClassInjector.UsingReflection(ClassLoader.getSystemClassLoader(), getClass().getProtectionDomain())
Class<?> nexusType = new ClassInjector.UsingReflection(ClassLoader.getSystemClassLoader(), ClassLoadingStrategy.NO_PROTECTION_DOMAIN)
.inject(Collections.singletonMap(TypeDescription.ForLoadedType.of(Nexus.class), ClassFileLocator.ForClassLoader.read(Nexus.class)))
.get(TypeDescription.ForLoadedType.of(Nexus.class));
return new Dispatcher.Available(nexusType.getMethod("register", String.class, ClassLoader.class, ReferenceQueue.class, int.class, Object.class),

Loading…
Cancel
Save