"SSO single Point Series" (2): Personalization of CAS login page

Source: Internet
Author: User

Previous "SSO single Point Series" (1): CAS environment construction introduces the establishment of CAS's simplest environment, and an example to explain one of the most basic uses of CAs. Today is mainly about how to personalize the CAS login page.

I. Start

CAS is the default login interface, you can see that this interface is definitely not directly used in the production environment, because there are many English, in short, this is a very unfriendly customer interface. So how do you change it? Let's keep looking down!

  PS: The address of this page in the project is cas\web-inf\view\jsp\default\ui\casloginview.jsp, Everyone can open to take a look.

  

Two. configuration file modification

In fact, all the interface locations of CAs are specified in Cas.properties (specific location:cas\web-inf\cas.properties). We open this file and find the following line

Cas.securitycontext.status.allowedsubnet=127.0.0.1cas.themeresolver.defaultthemename=cas-theme-default// Note the following line Cas.viewresolver.basename=default_views

See cas.viewResolver.basename This key value pair, its value is Default_views, represents the default view configuration, is actually a properties file name just. Let's find out if there is a file named Default_views.properties (Specific location:cas\web-inf\classes\default_views.properties ) in the project, The specific contents of the document are as follows:

Casloginview. (Class) =Org.springframework.web.servlet.view.JstlViewcasLoginView.url=/web-inf/view/jsp/default/ui/casloginview.jsp### Display Login (warning) messagescasloginmessageview. (Class)=Org.springframework.web.servlet.view.JstlViewcasLoginMessageView.url=/web-inf/view/jsp/default/ui/casloginmessageview.jsp### Login Confirmation View (logged in, warn=true) Casloginconfirmview. (Class)=Org.springframework.web.servlet.view.JstlViewcasLoginConfirmView.url=/web-inf/view/jsp/default/ui/casconfirmview.jsp### logged-in View (logged in,no service provided) Caslogingenericsuccessview. (Class)=Org.springframework.web.servlet.view.JstlViewcasLoginGenericSuccessView.url=/web-inf/view/jsp/default/ui/casgenericsuccess.jsp### Logout View (/logout) Caslogoutview. (Class)=Org.springframework.web.servlet.view.JstlViewcasLogoutView.url=/web-inf/view/jsp/default/ui/caslogoutview.jsp//omitted

Can see our login page is configured in the above, also configured the login Success page, exit page, etc., this will be specified later.

We know the page configuration, then it is possible to tailor a set of pages according to the business.

1. Modify the cas.viewResolver.basename value to bokeyuan_view in cas.properties so the system will automatically find the Bokeyuan _view.properties This configuration file

2.1th find the bokeyuan_view.properties is not, we have to create a new, directly copy the original default_views.properties on the line, renamed to Bokeyuan_view.properties

3. However the address in the Bokeyuan_view.properties or the /web-inf/view/jsp/default , we replace the address with the Web-inf\view\jsp\bokeyuan

4. Next we copy all the files under Cas\web-inf\view\jsp\default and rename them to the name we need , Cas\web-inf\view\jsp\bokeyuan

5. So we can change the login interface at will.

PS: Some people say that directly modify the original cas\web-inf\view\jsp\default\ui\casloginview.jsp on the line, save trouble. In fact, this is OK, but if you need the initial interface, then it is gone.

Configuration modifications are primarily more flexible and can retain the original backup.

PPS: The jquery library in the login interface is configured in cas\web-inf\view\jsp\default\ui\includes\bottom.jsp , but this is Direct reference to Googleapis, we are not accessible, need to be modified to your local or accessible CDN library (Baidu CDN, 360CDN, etc.)

PPPS: You can modify the original interface at will, but the original logic can not be modified, in fact, the main thing is form:form the label of the things do not change. Anyway you only modify the style, is certainly not wrong

Iii. Summary

This allows us to personalize our login interface as per our needs.

The original interface only the name, password two form, you may also want to add a verification code, plus Verification code in the next article to introduce, we look forward to!

All right, finish the call!

  

"SSO single Point Series" (2): Personalization of CAS login page

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.