Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure CAS CAPTCHA

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

I hope you can read it carefully and be able to achieve something!

Specific content

Now it is possible to use CAS to control the login of the database and remember the password, but there is still a practical problem: in order to prevent possible violent cracking, there must be a CAPTCHA detection operation before logging in.

But the problem now is that CAS belongs to a third-party project, not its own project, so if you want to achieve such a CAPTCHA operation, you must expand the existing program classes to complete. 1, in order to facilitate the preparation of CAPTCHA program class, it is recommended to establish a new project, this project needs to configure the cas development package (you configure all the packages of the entire CAS).

2. The real CAPTCHA detection can not be realized by the program class which only depends on the CAPTCHA server verification, so it is necessary to create an Action program class specially for CAPTCHA detection.

Parent class: org.jasig.cas.web.flow.AuthenticationViaFormAction

3. Establish an exception class: establish an exception handling class when the data is empty:

Define an error class when entering an error in the CAPTCHA:

4. Package and export the program at this time and export it as a "rand-code.jar" file

5. Append CAPTCHA to the project: kaptcha-0.0.9.jar, filters-2.0.235.jar

Upload the previous development package and the one generated by CAPTCHA to Linux and save it in the cas directory

Mv/srv/ftp/*.jar/usr/local/tomcat/webapps/cas/WEB-INF/lib/

6. Modify the "cas/WEB-INF/web.xml" file in the cas project and append the CAPTCHA to show:

Mv / srv/ftp/web.xml / usr/local/tomcat/webapps/cas/WEB-INF/

7. Modify the "cas/WEB-INF/cas-servlet.xml" configuration file, mainly to modify the program class used in the verification operation: a program class has been customized before: cn.mldn.rand.action.AuthenticationViaFormWithRandAction; original content:

Updated content:

Replace this file with the old file on the server:

Mv / srv/ftp/cas-servlet.xml / usr/local/tomcat/webapps/cas/WEB-INF/

8. Modify the "cas/WEB-INF/webflow/login/ login-webflow.xml" page configuration file; original content:

New content replaced:

Add input validation processing for CAPTCHA to the project:

This file is then updated: mv / srv/ftp/login-webflow.xml / usr/local/tomcat/webapps/cas/WEB-INF/webflow/login

9. Modify the resource file: cas/WEB-INF/classes/messages_zh_CN.properties

Replace this configuration file: mv / srv/ftp/messages_zh_CN.properties / usr/local/tomcat/webapps/cas/WEB-INF/classes/

10. Define the interface and modify "cas/WEB-INF/view/jsp/default/ui/casLoginView.jsp"

Replace the new ui file: mv / srv/ftp/casLoginView.jsp / usr/local/tomcat/webapps/cas/WEB-INF/view/jsp/default/ui/

This is the end of "how to configure CAS CAPTCHA". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report