JASIG CAS 3 Learning Note 1 -- getting started

本文介绍如何部署和配置CAS单点登录系统,包括CAS服务器和客户端应用的安装步骤、HTTPS连接配置、证书生成及导入过程,以及如何通过修改web.xml启用单点登录功能。

 

Background Information

 

Access Control

 

Access control systems provide the essential services of authorization, identification and authentication, access approval, and accountability:

 

·         authorization specifies what a subject can do

 

·         identification and authentication ensure that only legitimate subjects can log on to a system

 

·         access approval grants access during operations, by association of users with the resources that they are allowed to access, based on the authorization policy

 

·         accountability identifies what a subject (or all subjects associated with a user) did

 

Central Authentication Service (CAS) is a solution for Authentication Service.

 

Single Sign-On

 

Single sign-on (SSO) is a property of access control of multiple related, but independent software systems. With this property a user logs in once and gains access to all systems without being prompted to log in again at each of them. Conversely, single sign-off is the property whereby a single action of signing out terminates access to multiple software systems.

 

To implement a single sign-on system, the following two requirments must be considered:

 

·         An unified authentication service

 

·         Change all the web apps which need SSO service to make sure they use the unified authentication service.

 

Transport Layer Security (TLS) and its predecessor Secure Sockets Layer (SSL)

 

JASIG Central Authentication Service (CAS)

The CAS protocol involves at least three parties: a client web browser, the web application requesting authentication, and the CAS server. It may also involve a back-end service, such as a database server, that does not have its own HTTP interface but communicates with a web application.

When the client visits an application desiring to authenticate to it, the application redirects it to CAS. CAS validates the client's authenticity, usually by checking a username and password against a database (such as Kerberos or Active Directory).

If the authentication succeeds, CAS returns the client to the application, passing along a security ticket. The application then validates the ticket by contacting CAS over a secure connection and providing its own service identifier and the ticket. CAS then gives the application trusted information about whether a particular user has successfully authenticated.

CAS allows multi-tier authentication via proxy address. A cooperating back-end service, like a database or mail server, can participate in CAS, validating the authenticity of users via information it receives from web applications. Thus, a webmail client and a webmail server can all implement CAS.

 

 

Preparation Work

Download CAS server and client

Download CAS server and client from internet:

·         cas-client-3.2.1

·         cas-server-3.5.2

User Keytool to generate keystore file and import certificate file

It includes 3 steps:

·         Delete the certificate and keystore file if they exist

·         Create the .keystore file and export .crt file from keystore

·         Import the created certificate into java trusted certficate repository

Before you run below batch script, you need to make sure:

·         JDK is better not installed in default path: C:\program files\java because “program files” contains a blank character which could cause weird problems.

·         Make sure the same JDK is used by tomcat server in eclipse.

·         JAVA_HOME is set in system environment variable

·         Java bin executables are included in PATH

The batch script is listed as below:

keytool -delete -alias tomcatsso -keystore %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit

keytool -delete -alias tomcatsso -storepass changeit

keytool -genkey -keyalg RSA -keysize 1024 -alias tomcatsso -dname "CN=localhost" -storepass changeit

keytool -export -alias tomcatsso -file %java_home%/jre/lib/security/tomcatsso.crt -storepass changeit

keytool -import -alias tomcatsso -file %java_home%/jre/lib/security/tomcatsso.crt -keystore %java_home%/jre/lib/security/cacerts -storepass changeit

Keytool is provied by jdk.

The password for –storepass is used the access the jdk trusted certficate repository, and its default password is changeit.

-dname represents the certificat owners information. It has the following options:

CN=Computer Name, OU=Organization Unit Name,  O=Organization Name, L=City or Region Name, ST=State Name, C=Country Name

CN should be the full computer name, but it can be localhost

CAS Server Deployment

Create the CasServer project

Click Eclipse->File->New->Dynamic Web Project to create the web project, select Target Runtime as Apache Tomcat v7.0, select Dynamic web module version as 3.0, select configuration as Default Configuration for Apache Tomcat v7.0

Unzip cas-server-3.5.2.zip file, in the extracted folder you can find cas-server-uber-webapp-3.5.2.war, unzip this file to the project folder: /CasServer/WebContent

Configure server.xml to enable HTTPS connection

If you have created a tomcat server for CasServer, the configuration file for this tomcat server should be under project Servers.

Open server.xml file in /Servers/Tomcat v7.0 Server at localhost-config/server.xml

Add/Replace the follow xml script to Tenable HTTPS connector:

<Connector SSLEnabled="true" clientAuth="false"

                  keystoreFile="C:/Documents and Settings/yourname/.keystore" keystorePass="changeit"

                  maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https"

                  secure="true" sslProtocol="TLS"

                  truststoreFile="C:/Java/jdk1.7.0_45/jre/lib/security/cacerts" />

Login CasServer by using HTTPS connection

Add CasServer to tomcat for the deployment

Start tomcat server

Access CasServer web application by using url: https://localhost:8443/CasServer

If login successful, the following screen should be displayed:

CAS Application Deployment

Create the CasSample project

Click Eclipse->File->New->Dynamic Web Project to create the web project, select Target Runtime as Apache Tomcat v7.0, select Dynamic web module version as 3.0, select configuration as Default Configuration for Apache Tomcat v7.0

Unzip cas-client-3.2.1.zip file, in the extracted folder you can find all the lib jars under cas-client-3.2.1\modules, copy the following required jar to project folder: /CasSample/WebContent/WEB-INF/lib:

·         cas-client-core-3.1.12.jar

·         commons-codec-1.8.jar

·         log4j-1.2.16.jar

·         opensaml1-1.1.jar

·         xmlsec-1.4.3.jar

Configure web.xml to enable SSO

Copy the follow script into web.xml,

serverName should be the same as CN value of created certificate(-dname "CN=localhost")

 

<filter>

      <filter-name>CAS Authentication Filter</filter-name>

      <filter-class>org.jasig.cas.client.authentication.Saml11AuthenticationFilter</filter-class>

      <init-param>

            <param-name>casServerLoginUrl</param-name>

            <param-value>https://localhost:8443/CasServer/login</param-value>

      </init-param>

      <init-param>

            <param-name>serverName</param-name>

            <param-value>https://localhost:8443</param-value>

      </init-param>

</filter>

 

<filter>

      <filter-name>CAS Validation Filter</filter-name>

      <filter-class>org.jasig.cas.client.validation.Saml11TicketValidationFilter</filter-class>

      <init-param>

            <param-name>casServerUrlPrefix</param-name>

            <param-value>https://localhost:8443/CasServer</param-value>

      </init-param>

      <init-param>

            <param-name>serverName</param-name>

            <param-value>https://localhost:8443</param-value>

      </init-param>

      <init-param>

            <param-name>redirectAfterValidation</param-name>

            <param-value>true</param-value>

      </init-param>

      <init-param>

            <param-name>useSession</param-name>

            <param-value>true</param-value>

      </init-param>

      <init-param>

            <param-name>acceptAnyProxy</param-name>

            <param-value>true</param-value>

      </init-param>

</filter>

 

<filter>

      <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>

      <filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>

</filter>

 

<filter-mapping>

      <filter-name>CAS Validation Filter</filter-name>

      <url-pattern>/*</url-pattern>

</filter-mapping>

 

<filter-mapping>

      <filter-name>CAS Authentication Filter</filter-name>

      <url-pattern>/*</url-pattern>

</filter-mapping>

 

<filter-mapping>

      <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>

      <url-pattern>/*</url-pattern>

</filter-mapping>

Login CasSample by using SSO

Add CasSample to tomcat for the deployment

Start tomcat server

Access CasServer web application by using url: http://localhost:8080/CasSample/

If login successful, the following screen should be displayed:

 

Click Yes and the CAS login screen is displayed, input any username and password as same string.

The index.jsp for CasSample is displayed, and Authenticated Usr Id is displayed correctly.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

代码转载自:https://pan.quark.cn/s/f87b8041184b Language: 中文 欢迎来到戈戈圈! 当你点开这个存储库的时候,你会看到戈戈圈的图标↓ 本图片均在知识共享 署名-相同方式共享 3.0(CC BY-SA 3.0)许可协议下提供,如有授权遵照授权协议使用。 那么恭喜你,当你看到这个图标的时候,就代表着你已经正式成为了一名戈团子啦! 欢迎你来到这个充满爱与希望的大家庭! 「与大家创造更多快乐,与人们一起改变世界。 」 戈戈圈是一个在中国海南省诞生的创作企划,由王戈wg的妹妹于2018年7月14日正式公开。 戈戈圈的创作类型广泛,囊括插画、小说、音乐等各种作品类型。 戈戈圈的目前成员: Contributors 此外,支持戈戈圈及本企划的成员被称为“戈团子”。 “戈团子”一词最初来源于2015年出生的名叫“团子”的大熊猫,也因为一种由糯米包裹着馅料蒸熟而成的食品也名为“团子”,不仅有团圆之意,也蕴涵着团结友爱的象征意义和大家的美好期盼,因此我们最终于2021年初决定命名戈戈圈的粉丝为“戈团子”。 如果你对戈戈圈有兴趣的话,欢迎加入我们吧(σ≧︎▽︎≦︎)σ! 由于王戈wg此前投稿的相关视频并未详细说明本企划的信息,且相关视频的表述极其模糊,我们特此创建这个存储库,以文字的形式向大家介绍戈戈圈。 戈戈圈自2018年7月14日成立至今,一直以来都秉持着包容开放、和谐友善的原则。 我们深知自己的责任和使命,始终尊重社会道德习俗,严格遵循国家法律法规,为维护社会稳定和公共利益做出了积极的贡献。 因此,我们不允许任何人或组织以“戈戈圈”的名义在网络平台或现实中发布不当言论,同时我们也坚决反对过度宣传戈戈圈的行为,包括但不限于与戈戈圈无关的任何...
内容概要:本文详细介绍了一个基于YOLOv8的血细胞智能检测系统全流程开发指南,涵盖从环境搭建、数据准备、模型训练与验证到UI交互系统开发的完整实践过程。项目利用YOLOv8高精度、高速度的优势,实现对白细胞、红细胞和血小板的自动识别与分类,准确率超过93%,单张图像检测仅需0.3秒。通过公开或自建血细胞数据集,结合LabelImg标注工具和Streamlit开发可视化界面,构建了具备图像上传、实时检测、结果统计与异常提示功能的智能系统,并提供了论文撰写与成果展示建议,强化其在医疗场景中的应用价值。; 适合人群:具备一定Python编程与深度学习基础,从事计算机视觉、医疗AI相关研究或项目开发的高校学生、科研人员及工程技术人员,尤其适合需要完成毕业设计或医疗智能化项目实践的开发者。; 使用场景及目标:①应用于医院或检验机构辅助医生进行血涂片快速筛查,提升检测效率与一致性;②作为深度学习在医疗影像领域落地的教学案例,掌握YOLOv8在实际项目中的训练、优化与部署流程;③用于学术论文写作与项目成果展示,理解技术与临床需求的结合方式。; 阅读建议:建议按照“数据→模型→系统→应用”顺序逐步实践,重点理解数据标注规范、模型参数设置与UI集成逻辑,同时结合临床需求不断优化系统功能,如增加报告导出、多类别细粒度分类等扩展模块。
基于蒙特卡洛,copula函数,fuzzy-kmeans获取6个典型场景进行随机优化多类型电动汽车采用分时电价调度,考虑上级电网出力、峰谷差惩罚费用、风光调度、电动汽车负荷调度费用和网损费用内容概要:本文围绕多类型电动汽车在分时电价机制下的优化调度展开研究,采用蒙特卡洛模拟、Copula函数和模糊K-means聚类方法获取6个典型场景,并在此基础上进行随机优化。模型综合考虑了上级电网出力、峰谷差惩罚费用、风光可再生能源调度、电动汽车负荷调度成本以及电网网损费用等多个关键因素,旨在实现电力系统运行的经济性与稳定性。通过Matlab代码实现相关算法,验证所提方法的有效性与实用性。; 适合人群:具备一定电力系统基础知识和Matlab编程能力的研究生、科研人员及从事新能源、智能电网、电动汽车调度相关工作的工程技术人员。; 使用场景及目标:①用于研究大规模电动汽车接入电网后的负荷调控策略;②支持含风光等可再生能源的综合能源系统优化调度;③为制定合理的分时电价政策及降低电网峰谷差提供技术支撑;④适用于学术研究、论文复现与实际项目仿真验证。; 阅读建议:建议读者结合文中涉及的概率建模、聚类分析与优化算法部分,动手运行并调试Matlab代码,深入理解场景生成与随机优化的实现流程,同时可扩展至更多元化的应用场景如V2G、储能协同调度等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值