(3) log out of the sso cas framework from the CAS logon page.

Source: Internet
Author: User

Due to changes in requirements, the CAS custom login page is not secure and no longer used, so I suddenly went back to the origin and deployed CAS without a custom login interface on Linux, next, modify the default logon interface of CAs as our interface.

It is impossible to modify the source code of CAS at once, so you can delete the source code of CAS, see the effect, and then delete unnecessary things to see the effect, in addition, the style of your system logon interface is created step by step. After the logon interface is completed, the CAS default logout interface is displayed.

The logout interface is required. When logging out, return to the logon main interface and modify the CAS logout interface.

There are many similar articles to modify the User-Defined logout interface, but this method does not seem to work for Logon using a unified interface, and even if it can be transferred to the login interface, however, when you log on, it is not the system interface you want to jump. To solve this problem, we found that the reason why the First Login can be transferred to the main interface is that the First Login address will carry the address after the login to enter the system address, https://xx.com: 8443/CAS/login? Service = http % 3A % 2f % 2f172. 16.3.199% 3a8080% 2 fsecurity % 2f, so that I can follow him to create one, and the caslogoutview in CAS. the JS jump function is added to JSP. when loading the login page, it directly redirects to the corresponding system logon Based on the passed system parameters and the system. The modified CAS logout interface code is as follows: casloginoutview. JSP code

<! -- Xx add 2014/7/15/20 add --> <! -- Jump to the logon interface of different systems based on the URL. --> <script language = "JavaScript" type = "text/JavaScript"> window. onload = function () // use the onload event of the window. When the form is loaded, {// do something var result = location. search. match (New Regexp ("[\? \ &] "+ 'Systemid' +" = ([^ \ &] +) "," I "); If (result = NULL | result. length <1) {// return ""; Result = "" ;}// alert (result [1]); // return result [1]; if ("security" = Result [1]) {// alert ("dfdfsdfasdfasdfasdf"); window. location. href = "https://www.xx.com: 8443/CAS/login? Service = http % 3A % 2f % 2f172. 16.3.199% 3a8080% 2 fsecurity % 2f ";} else {window. Location. href =" https://www.xx.com: 8443/CAS/login? Service = http % 3A % 2f % 2f172. 16.3.199% 3a8080% 2fvms2. 0% 2 Fuser % 2 ftomain % 2f ";}}<! -- Encapsulated as a function, you can also directly call. --> function getquerystringbyname (name) {var result = location. Search. Match (New Regexp ("[\? \ &] "+ Name +" = ([^ \ &] +) "," I "); If (result = NULL | result. length <1) {return "" ;}alert (result [1]); return result [1] ;}</SCRIPT>


CAS then adds a parameter to its system logout address, for example, my system is https://www.xx.com: 8443/CAS/logout? Systemid = security. In this way, you will not jump to the same address, and you will not find the desired interface when you log on to the logon page.


CAS has been working for some time and is constantly improving. When you move forward, you will find that new problems are emerging, problems are constantly emerging, and demands are constantly changing, it seems that if you don't use the CAS source code, you don't have to worry about it. Your brother ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.