Project.net Config CAS SSO

一、环境
Tomcat6.0
Project.net9.2
CAS3.5
二、配置CAS
参考我的另一篇文章: 配置CAS
三、Configuring CAS SSO for Project.net
1、打开文件\webapps\pnet\WEB-INF\web.xml,增加
<!-- CAS -->
		<filter>
		        <filter-name>CAS Authentication Filter</filter-name>
		        <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
		        <init-param>
		                <param-name>casServerLoginUrl</param-name>
		                <param-value>https://demo.wuyunmin.com:8444/cas/login</param-value>
		        </init-param>
		        <init-param>
		                <param-name>serverName</param-name>
		                <param-value>http://demo.wuyunmin.com:9090</param-value>
		        </init-param>
		</filter>
		<filter>
		        <filter-name>CAS Validation Filter</filter-name>
		        <filter-class>org.jasig.cas.client.validation.Cas10TicketValidationFilter</filter-class>
		        <init-param>
		                <param-name>casServerUrlPrefix</param-name>
		                <param-value>https://demo.wuyunmin.com:8444/cas</param-value>
		        </init-param>
		        <init-param>
		                <param-name>serverName</param-name>
		                <param-value>http://demo.wuyunmin.com:9090</param-value>
		        </init-param>
		</filter>
		<filter>
		        <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
		        <filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>
		</filter>
		
	   <filter-mapping>
	        <filter-name>CAS Authentication Filter</filter-name>
	    	<url-pattern>/*</url-pattern>
		</filter-mapping>
		<filter-mapping>
	        <filter-name>CAS Validation Filter</filter-name>
	    	<url-pattern>/*</url-pattern>
		</filter-mapping>
		<filter-mapping>
	        <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
	    	<url-pattern>/*</url-pattern>
		</filter-mapping>
		<!-- /CAS -->

2、打开文件\webapps\pnet\sso\SSOLogin.jsp,修改文件第46行,如下:
boolean ssoEnabled = PropertyProvider.getBoolean("prm.global.login.sso.allowSSO");
	if (!ssoEnabled) {
		//SSO is disabled
		pageContext.forward("/Login.jsp");
		return;
	}
	
	String remoteUser = request.getRemoteUser();//被修改的行
	if ((remoteUser == null)||(remoteUser.equals(""))) {
		//no header. this is system error.
		pageContext.forward("/sso/NoHeader.jsp");
		return;
	}

3、打开文件\webapps\pnet\sso\LoggedOut.jsp,在文件头上增加:
<%
response.sendRedirect("https://demo.wuyunmin.com:8444/cas/logout");
%>

4、更新数据库
update pn_property set property_value=1 where property='prm.global.login.sso.allowSSO';
5、从cas项目目录下复制jar文件:\webapps\cas\WEB-INF\lib\cas-client-core-3.2.1.jar到Project.net项目下的lib文件夹中。

你可能感兴趣的:(SSO,cas,project.net)