基本配置 参考之前得随笔  http://www.cnblogs.com/rocky-fang/p/5354947.html

1. tomcat-cas 修改配置

1.1 在D:\test\sso\tomcat-cas\webapps\cas\WEB-INF下 找到deployerConfigContext.xml ,修改如下:

注释掉

    <!--
<bean id="primaryAuthenticationHandler"
class="org.jasig.cas.authentication.AcceptUsersAuthenticationHandler">
<property name="users">
<map>
<entry key="casuser" value="Mellon"/>
</map>
</property>
</bean>
-->

增加

<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
p:driverClass="com.mysql.jdbc.Driver"
p:jdbcUrl="jdbc:mysql://127.0.0.1:3306/cas?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull"
p:user="root"
p:password="root" /> <!-- Define the encode method-->
<!--<bean id="passwordEncoder"
class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder" autowire="byName">
<constructor-arg value="MD5"/>
</bean> -->
<bean id="passwordEncoder"
class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder"
c:encodingAlgorithm="MD5"
p:characterEncoding="UTF-8" /> <bean id="dbAuthHandler"
class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler"
p:dataSource-ref="dataSource"
p:sql="select password from user where name=? and used=1"
p:passwordEncoder-ref="passwordEncoder"/>

修改

    <bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager">
<constructor-arg>
<map>
<!--
| IMPORTANT
| Every handler requires a unique name.
| If more than one instance of the same handler class is configured, you must explicitly
| set its name to something other than its default name (typically the simple class name).
-->
<entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" />
<!--改为--><entry key-ref="dbAuthHandler" value-ref="primaryPrincipalResolver" />
<!--注释掉<entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" />-->
</map>
</constructor-arg>

1.2 创建数据库 建表 插入数据

CREATE DATABASE /*!32312 IF NOT EXISTS*/`cas` /*!40100 DEFAULT CHARACTER SET gbk */;

USE `cas`;

/*Table structure for table `user` */

DROP TABLE IF EXISTS `user`;

CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`used` tinyint(2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=gbk; /*Data for the table `user` */ insert into `user`(`id`,`name`,`password`,`used`) values (1,'casuser','9414f9301cdb492b4dcd83f8c711d8bb',1);

1.3 加入jar包

2. 测试

访问 https://demo.cdv.com:8443/cas/login

使用 casuser + Mellon 登录

成功, 此时验证是从数据库查询的密码比较而来。

sso demo mysql ( cas )的更多相关文章

  1. sso demo 取消https (cas)

    基本配置 参考之前得随笔  http://www.cnblogs.com/rocky-fang/p/5354947.html 1. 修改tomcat-cas 配置 1.1 在 D:\test\sso\ ...

  2. 单点登录系统构建之二——SSO原理及CAS架构

    基本概念 SSO(Single Sign On)单点登录,是在多个应用系统中,用户只需要登录一次就能访问所有相互信任的应用系统.它包括将这次的主要登录映射到其他应用中用户同一个用户的登录机制. SSO ...

  3. sso demo ( cas )

    1. generate keystore command : keytool -genkey -alias testtomcat -keyalg RSA -keystore "C:\User ...

  4. SSO之安装CAS Server

    JA-SIG CAS(Central Authentication Service)为Web应用系统提供了单点登录服务.它的特性包括:一个开放和具有很好文档支持的协议:一个Java开源服务器组件:提供 ...

  5. Visual Studio 2017 - Windows应用程序打包成exe文件(2)- Advanced Installer 关于Newtonsoft.Json,LINQ to JSON的一个小demo mysql循环插入数据、生成随机数及CONCAT函数 .NET记录-获取外网IP以及判断该IP是属于网通还是电信 Guid的生成和数据修整(去除空格和小写字符)

    Visual Studio 2017 - Windows应用程序打包成exe文件(2)- Advanced Installer   Advanced Installer :Free for 30 da ...

  6. 聊聊单点登录(SSO)中的CAS认证

    SSO介绍 背景 随着企业的发展,一个大型系统里可能包含 n 多子系统, 用户在操作不同的系统时,需要多次登录,很麻烦,我们需要一种全新的登录方式来实现多系统应用群的登录,这就是单点登录. web 系 ...

  7. (转)基于CAS实现单点登录(SSO):cas client端的退出问题

    出处:http://blog.csdn.net/tch918/article/details/22276627 自从CAS 3.4就很好的支持了单点注销功能,配置也很简单. 之前版本因为在CAS服务器 ...

  8. [原]基于CAS实现单点登录(SSO):cas client端的退出问题

    自从CAS 3.4就很好的支持了单点注销功能,配置也很简单. 之前版本因为在CAS服务器通过HttpClient发送消息时并未指定为POST方式,所以在CAS客户端的注销Filter中没有收到POST ...

  9. java生成Https证书,及证书导入的步骤和过程

    以下是相关的Tomcat,JDK和Windows环境: Tomcat版本:tomcat-7.0.55 JDK版本: jdk1.6.0 目录所在的位置: Serve的目录:D:\server\tomca ...

随机推荐

  1. Python中的字符串与字符编码

    本节内容: 前言 相关概念 Python中的默认编码 Python2与Python3中对字符串的支持 字符编码转换 一.前言 Python中的字符编码是个老生常谈的话题,同行们都写过很多这方面的文章. ...

  2. 快速入门系列--WebAPI--04在老版本MVC4下的调整

    WebAPI是建立在MVC和WCF的基础上的,原来微软老是喜欢封装的很多,这次终于愿意将http编程模型的相关细节暴露给我们了.在之前的介绍中,基本上都基于.NET 4.5之后版本,其System.N ...

  3. JTMz换路径导致MySQL服务不能启动的问题

    问题: JTMz解压到我的机器上,运行一次后,把服务停止了,然后移到了另外一个路径,JTMz中自带的MySQL服务启动不起来了. 解决: 在注册表中修改 HKEY_LOCAL_MACHINE\SYST ...

  4. 汇编程序的Hello world

    原文链接:http://www.orlion.ga/989/ 一.汇编程序的Hello world x86 AT&T: .data   msg:       .ascii "Hell ...

  5. IllegalStateException : Web app root system property already set to different value问题详解

    一.问题描述     最近公司有了一个新项目,这个项目最近部署到测试服务器上的时候出现了一个问题. 严重: Exception sending context initialized event to ...

  6. 深入理解CSS中的空白符和换行

    前面的话 CSS3新增了两个换行属性word-wrap和word-break.把空白符和换行放在一起说,是因为实际上空白符是包括换行的,且常用的文本不换行是使用的空白符的属性white-space: ...

  7. php操作mongodb中的ISODate格式日期

    mongodb 中数据记录的日期格式为"dateCreated" : ISODate("2011-12-20T07:22:50.836Z")经过翻阅php官网中 ...

  8. Docker - Docker基础命令及使用

    Docker Docker - 官网 Docker - Hub GitHub - Docker Docker中文社区 Docker基础命令 Docker 查看帮助信息:docker --help 查看 ...

  9. iOS_UIImage_给图片添加水印

    github地址: https://github.com/mancongiOS/UIImage.git UIImage的Category UIImage+ImageWaterPrint.h #impo ...

  10. 谷歌插件Image downloader开发之popup

    Image downloader的交互逻辑是这样的:用户点击Image downloader的图标,会向页面(content script,见上一篇文章:谷歌插件Image downloader开发之 ...