CAS 服务器只接受来自 localhost 的请求
CAS server only accepts requests from localhost
我正在使用 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)
I tried editing hosts file on Windows by adding: 192.168.1.13 localhost, but no help. I also changed server name property in cas.properties from http://localhost:8080 to https://192.168.1.13:8443 but also no help.
是的,none 是相关的。
My question is, how can I make CAS server to accept requests that are not from localhost?
你没有也不能,因为问题不在 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-enabled 应用程序正在使用 edu.yale.its.tp.cas.client
,它是 Java CAS 客户端库的一个古老版本,已经停止使用超过 15 年未打补丁、更新或修改。您不妨重新考虑一下。
我正在使用 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)
I tried editing hosts file on Windows by adding: 192.168.1.13 localhost, but no help. I also changed server name property in cas.properties from http://localhost:8080 to https://192.168.1.13:8443 but also no help.
是的,none 是相关的。
My question is, how can I make CAS server to accept requests that are not from localhost?
你没有也不能,因为问题不在 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-enabled 应用程序正在使用 edu.yale.its.tp.cas.client
,它是 Java CAS 客户端库的一个古老版本,已经停止使用超过 15 年未打补丁、更新或修改。您不妨重新考虑一下。