CAS client 端添加初始化参数传到server端
1. 修改client 端web应用的web.xml,如下:
<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><!-- CAS服务端地址--><param-value>http://192.168.104.123:8080/cas/login</param-value></init-param><init-param><param-name>service</param-name><!-- 本地地址--><param-value>http://192.168.104.101:8080/*</param-value></init-param><init-param><param-name>renew</param-name><param-value>false</param-value><!-- 这个如果为true 每次登录子系统都要验证,就不能实现登陆一次,可以访问其他子系统的需求 --></init-param><init-param><param-name>webRootKey</param-name><param-value>test</param-value></init-param></filter>
/** * the web app root key */private String webRootKey;,
public final void setWebRootKey(final String webRootKey){ this.webRootKey = webRootKey; }
setWebRootKey(getPropertyFromInitParams(filterConfig, "webRootKey", null)); log.trace("Loaded WebRootKey parameter: " + this.webRootKey);
CommonUtils.assertNotNull(this.webRootKey, "webRootKey cannot be null.");
private static final long serialVersionUID = 179318697348051866L; /** the web root key */ private String webRootKey;public String getWebRootKey() {return webRootKey;}public void setWebRootKey(String webRootKey) {this.webRootKey = webRootKey;}
FinalUserCredentials finalUserCredentials = (FinalUserCredentials) credentials;String username = finalUserCredentials.getUsername();String password = finalUserCredentials.getPassword();/** get web root key */String webRootKey = finalUserCredentials.getWebRootKey();既可以获得webRootKey扩展参数。