拷贝以下代码到liferay的web.xml文件:
<filter>
<filter-name>CAS Required</filter-name>
<filter-class>edu.yale.its.tp.cas.client.filter.CASFilter</filter-class>
<init-param>
<param-name>edu.yale.its.tp.cas.client.filter.loginUrl</param-name>
<param-value>https://localhost:8443/cas/login</param-value>
</init-param>
<init-param>
<param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name>
<param-value>https://localhost:8443/cas/serviceValidate</param-value>
</init-param>
<init-param>
<param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name>
<param-value>localhost:8081</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CAS Required</filter-name>
<url-pattern>/c/portal/layout</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CAS Required</filter-name>
<url-pattern>/c/portal/login</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CAS Required</filter-name>
<url-pattern>/c/portal/group_forward</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CAS Required</filter-name>
<url-pattern>/c/portal/remove_portlet</url-pattern>
</filter-mapping>
将以下代码拷贝到portal-ext.properties:
company.security.auth.type=userId
auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin,com.liferay.portal.security.auth.CASAutoLogin
# disable auth pipeline (we use CAS for all this via auto.login.hooks)
auth.pipeline.pre=
auth.pipeline.enable.liferay.check=false
修改cas client的代码:edu.yale.its.tp.cas.client.Util
在函数getService中找到
if (request.getQueryString() != null)
修改为
if (request.getQueryString() != null && !"".equals(request.getQueryString().trim()))
编译,打包到liferay/WEB-INF/lib目录中。