This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev-2.1.5
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev-2.1.5 by this push:
new 1eaaecfa9 [Improve] shiro config minor improvement
1eaaecfa9 is described below
commit 1eaaecfa930ff8b72fdc05e4d59d45514cae2e1e
Author: benjobs <[email protected]>
AuthorDate: Sat Aug 31 20:04:14 2024 +0800
[Improve] shiro config minor improvement
---
.../streampark/common/util/ClassLoaderUtils.scala | 20 +++++++++++++-------
.../console/system/authentication/ShiroConfig.java | 7 -------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/util/ClassLoaderUtils.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/util/ClassLoaderUtils.scala
index 620f680e7..dc54d9271 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/util/ClassLoaderUtils.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/util/ClassLoaderUtils.scala
@@ -124,17 +124,23 @@ object ClassLoaderUtils extends Logger {
private[this] def addURL(file: File): Unit = {
val classLoader = ClassLoader.getSystemClassLoader
classLoader match {
- case c if c.isInstanceOf[URLClassLoader] =>
+ case c: URLClassLoader =>
val addURL = classOf[URLClassLoader].getDeclaredMethod("addURL",
Array(classOf[URL]): _*)
addURL.setAccessible(true)
addURL.invoke(c, file.toURI.toURL)
case _ =>
- val field = classLoader.getClass.getDeclaredField("ucp")
- field.setAccessible(true)
- val ucp = field.get(classLoader)
- val addURL = ucp.getClass.getDeclaredMethod("addURL",
Array(classOf[URL]): _*)
- addURL.setAccessible(true)
- addURL.invoke(ucp, file.toURI.toURL)
+ try {
+ val field = classLoader.getClass.getDeclaredField("ucp")
+ field.setAccessible(true)
+ val ucp = field.get(classLoader)
+ val addURL = ucp.getClass.getDeclaredMethod("addURL",
Array(classOf[URL]): _*)
+ addURL.setAccessible(true)
+ addURL.invoke(ucp, file.toURI.toURL)
+ } catch {
+ case _: NoSuchFieldException =>
+ throw new UnsupportedOperationException(
+ s"Add resource to classpath unsupported jdk version:
${System.getProperty("java.version")}")
+ }
}
}
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
index 64a85a350..3ccf84a9e 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
@@ -45,13 +45,6 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/actuator/**", "anon");
filterChainDefinitionMap.put("/h2-console/**", "anon");
- filterChainDefinitionMap.put("/doc.html", "anon");
- filterChainDefinitionMap.put("/swagger-ui.html", "anon");
- filterChainDefinitionMap.put("/swagger-ui/**", "anon");
- filterChainDefinitionMap.put("/swagger-resources/**", "anon");
- filterChainDefinitionMap.put("/v3/api-docs/**", "anon");
- filterChainDefinitionMap.put("/webjars/**", "anon");
-
filterChainDefinitionMap.put("/passport/**", "anon");
filterChainDefinitionMap.put("/systemName", "anon");
filterChainDefinitionMap.put("/member/teams", "anon");