Single sign-on using Eclipse to build a war deployment package for the CAS server

Source: Internet
Author: User
Tags cas tomcat










1 Download the project for building the CAS service-side war package






2 import Eclipse and start packaging






2.1 Importing code into Eclipse






2.2 Download dependency package into local maven repository






2.3 Modifying a configuration file






2.4 Building a war package






3 Deployment Testing











If you don't want to build it yourself, just need a war package already built, download it here:






http://download.csdn.net/detail/pucao_cug/9802028






If you want to build your own war pack manually, look down: 1. Download the project to build the CAS service-side war package






Open URL: https://apereo.github.io/cas/






Currently the latest version is the 5.0 series, so automatically jump to the following URL (if there are other series, should also automatically jump):






Https://apereo.github.io/cas/5.0.x/index.html











Click Overlayinstallation on the page






as shown in figure:
















After point will open a new page, pull under the net, find CAs Maven Overlay






as shown in figure:
















Click cas Maven Overlay






Jump to the project's GitHub page, https://github.com/apereo/cas-overlay-template











as shown in figure:
















Although the current CAS source code is the latest 5 series, But the project that can use MAVEN to build the war package is only 4.1 series and 4.2 series, the default is the Master branch, in order to download a stable version, I select the 4.2 branch (can be used in the branch drop-down box selection, you can also directly use this url:https:// github.com/apereo/cas-overlay-template/tree/4.2






)。






as shown in figure:





















After branching, click Colne or download Zip package to download the code






as shown in figure:











2. Import Eclipse and start packing 2.1 Importing code into Eclipse






Import the latest code that you just downloaded in Eclipse cas-overlay-template-4.2






as shown in figure:





















After importing eclipse as an existing MAVEN project, Eclipse will download the jar package to the remote MAVEN server based on the configuration of Pom.xml, which is too slow, it is recommended to download the jar packages from somewhere else to your MAVEN local library, and download the method to see the next section. 2.2. Download the dependency package to the local MAVEN repository






MAVEN's local repository does not need to be downloaded in the distance if it already has a dependency package required for the project, and it will be fast. The root directory of my local repository is: D:\apache-maven-repository






Download both the Cas-overlay and Cas-server-webapp resources to extract the two compressed packages into their own local libraries.






The download address for Cas-overlay is:






http://download.csdn.net/detail/pucao_cug/9801365











Download the Cas-overlay package and unzip it into the Org\jasig\cas directory of your local MAVEN repository, such as mine:






D:\apache-maven-repository\org\jasig\cas\cas-overlay











The download address for Cas-server-webapp is:






http://download.csdn.net/detail/pucao_cug/9801375











Download the Cas-server-webapp package and unzip it into the Org\jasig\cas directory of your local MAVEN repository, such as mine:






D:\apache-maven-repository\org\jasig\cas\cas-server-webapp






Under these two directories, there are also cas-server4.2.7-dependent packages






As shown in figure:






2.3. Modify the configuration file






In the newer version, Many of the CAS configuration is placed in the cas.properties, this file can be placed anywhere on the server, but need to modify propertyfileconfigurer.xml This configuration file, tell the CAS system cas.properties where to go to load






Open Propertyfileconfigurer.xml File






as shown in figure:
















Change the default/etc/cas/cas.properties path to the path of your own server to place the Cas.properties file, for example, I'm now deploying a Windows system that puts the file in the D:\webserver\cas\ Cas.properties, I've modified this configuration to






<util:properties id= "casproperties" location= "File:d:\webserver\cas\cas.properties"/>






as shown in figure:
















After the modification is complete, copy the Cas.properties file in the project to the place you configured above, for example, my own is D:\webserver\cas\cas.properties






as shown in figure:
















Note: If you do not modify this profile to tell the CAS system the location of the Cas.properties file, or if the file is not found in the specified location, an error will be given. For example:












' casproperties ': Invocation of init methodfailed; nested exception is java.io.filenotfoundexception:\etc\cas\ Cas.properties (the system cannot find the path specified.) )






2.4. Build a War package






Right-click on the project, Run as--> Maven Install






as shown in figure:





















Wait a moment, build to build the war package successfully






as shown in figure:
















With a war package, using the JDK to generate the certificate, import the certificate into the related configuration such as Tomcat and the previous written article is the same:






Build CAS server in single sign-on Windows (using cas-server4.1.3)











Note: 4.1.3 Configuration and 4.2.x above the series is not the same, for example 4.1.3 many configuration items are configured in Deployerconfigcontext.xml this file, and the most recent version packaged here is 4.2.7, such as adding users, or customizing their own login page configuration is almost in the Completed in Cas.properties (follow-up article to elaborate). 3, the deployment Test War package is good, how to deploy it, because you want to access the CAS service with the HTTPS protocol, so you need to generate a certificate, and a series of configuration of the Web container, Please refer to this article (this article is about how to deploy the cas4.1.3 War package in Tomcat, which is also used to deploy the war package of the war4.2.7 that we just built, just remember that you need to place the Cas.propertis file in the specified location) as described earlier in this article: http://blog.csdn.net/pucao_cug/article/details/68942734






Deploy the Cas.war to your own web container and access the test with a browser






as shown in figure:






















Note: There are a lot of things in the war that are downloaded from GitHub, and then packaged out, are original, and if you want to modify the configuration, add the jar package to modify the database configuration, read the database user account and password to complete the login verification, and let the server from the database after successful login Read more user information back to the client to use, then you need to continue to read the blog:






http://blog.csdn.net/pucao_cug/article/details/70182968




Related Article

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.