项目中的单点登录是通过CAS配置的,如果是未登录状态,那么请求在通过CAS过滤器校验时会转向登陆页面,无法通过访问类似http://localhost:8080/portal/business-plugin/charge/rfgl/pay/showPayList.jsp的方式访问到项目中的静态资源。现要开放一个页面给第三方,仅用于数据查阅,需要去掉该页面的校验,方法如下:
<filter> <filter-name>CASFilter</filter-name> <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> <init-param> <param-name>casServerLoginUrl</param-name> <!-- cas路径 --> <param-value>http://localhost:8080/cas/login</param-value> </init-param> <init-param> <param-name>serverName</param-name> <!-- 业务系统路径 --> <param-value>http://localhost:8080</param-value> </init-param> <init-param> <!-- 不需通过校验的请求资源,用正则表达式表示 --> <param-name>ignorePattern</param-name> <param-value>/js/*|/business-plugin/charge/charge-resource/images/*|/restful/*|business-plugin/charge/rfgl/pay/showPayList.jsp</param-value> </init-param> </filter> <filter-mapping> <filter-name>CASFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>