CAS服务器只接受来自本地主机的请求



我使用CAS服务器在Tomcat服务器中处理web应用程序的身份验证,当我从本地主机发送请求时,一切都很好,比如:https://localhost:8443/WebApp.

但是,例如,如果我想从我的虚拟机发送请求,我会使用主机的专用网络IPv4地址,它看起来像:https://192.168.1.13:8443/WebApp.

但我得到了一个例外:java.lang.IllegalArgumentException: unrecognized server name : 192.168.1.13:8443

我尝试在Windows上添加:192.168.1.13 localhost来编辑主机文件,但没有任何帮助。我还将cas.properties中的服务器名称属性从http://localhost:8080到https://192.168.1.13:8443但也无济于事。

我的问题是,如何使CAS服务器接受非本地主机的请求?它甚至不会接受127.0.0.1,只要它说localhost?

全栈跟踪:

мар 18, 2022 7:31:15 ПО ПОДНЕ org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [rest.api.CASServlet] in context with path [/Documents] threw exception
java.lang.IllegalArgumentException: unrecognized server name : 192.168.1.13:8443
at edu.yale.its.tp.cas.client.Util.getService(Util.java:72)
at edu.yale.its.tp.cas.client.filter.CASFilter.getService(CASFilter.java:492)
at edu.yale.its.tp.cas.client.filter.CASFilter.redirectToCAS(CASFilter.java:513)
at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:378)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:94)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:659)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:261)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:831)
мар 18, 2022 7:31:15 ПО ПОДНЕ org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [/Documents] threw exception
java.lang.IllegalArgumentException: unrecognized server name : 192.168.1.13:8443
at edu.yale.its.tp.cas.client.Util.getService(Util.java:72)
at edu.yale.its.tp.cas.client.filter.CASFilter.getService(CASFilter.java:492)
at edu.yale.its.tp.cas.client.filter.CASFilter.redirectToCAS(CASFilter.java:513)
at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:378)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:94)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:659)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:261)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:831)

我尝试在Windows上添加:192.168.1.13 localhost来编辑主机文件,但没有任何帮助。我还将cas.properties中的服务器名称属性从http://localhost:8080到https://192.168.1.13:8443但也无济于事。

是的,这些都不相关。

我的问题是,如何使CAS服务器接受非本地主机的请求?

您没有,也不能,因为问题不在CAS服务器。您的日志显示,当请求首先到达您的应用程序时,它将停止:

java.lang.IllegalArgumentException: unrecognized server name : 192.168.1.13:8443
at edu.yale.its.tp.cas.client.Util.getService(Util.java:72)
at edu.yale.its.tp.cas.client.filter.CASFilter.getService(CASFilter.java:492)
at edu.yale.its.tp.cas.client.filter.CASFilter.redirectToCAS(CASFilter.java:513)
at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:378)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

注意其中的单词cas.client。这意味着,CAS服务器中没有任何内容会被修改,因为您需要修复客户端应用程序才能正确接受请求。

CAS在很大程度上不在乎请求来自何处(除非在非常非常特殊的情况下(。

PS您的日志还显示您的启用CAS的应用程序正在使用edu.yale.its.tp.cas.client,这是Java CAS客户端库的一个古老版本,已停止使用,15年多没有进行过修补、更新或修改。你不妨重新考虑一下。

相关内容

  • 没有找到相关文章

最新更新