CAS服务端添加验证码
一、利用CAS实现单点登录
二、CAS客户端授权JDBC三、为CAS单点登录服务器增加验证码功能四、CAS RememberMe功能实现
添加jcaptcha.jar文件
web.xml:
增加
<servlet-mapping>
<servlet-name>cas</servlet-name>
<url-pattern>/captcha.htm</url-pattern>
</servlet-mapping>
login_webflow.xml:
?? <action-state id="bindAndValidate">
?? ??? <action bean="authenticationViaFormAction" />
?? ??? <transition on="success" to="submit" />
?? ??? <transition on="error" to="viewLoginForm" />
?? </action-state>
替换为
??? <action-state id="bindAndValidate">
????? <action bean="authenticationViaFormAction" />
????? <transition on="success" to="captchaValidate" />
????? <transition on="error" to="viewLoginForm" />
??? </action-state>
增加
?? <action-state id="captchaValidate">
?? ??? <action bean="captchaValidateAction" />
?? ??? <transition on="success" to="submit" />
?? ??? <transition on="error" to="viewLoginForm" />
?? </action-state>
cas_servlet.xml:
增加
?????? <prop key="/captcha.htm">captchaImageCreateController</prop>
??? <bean id="captchaValidateAction" ref="jcaptchaService"/>
??? </bean>
??? <bean id="fastHashMapCaptchaStore" />
<bean id="jcaptchaService" index="0">
??????????? <ref bean="fastHashMapCaptchaStore"/>
??????? </constructor-arg>
??????? <constructor-arg type="com.octo.captcha.engine.CaptchaEngine" index="1">
??????????? <bean />
<input type="text" id="j_captcha_response" name="j_captcha_response" />
?
要添加 jcaptcha-1.0-all.jar包到项目JAR包库中