cas 单点登陆实战-sso-config篇(四)

本篇章继续讲解写cas时遇到的坑------证书生成。

在window下的证书生成,在linxu下的cas证书生成,证书用域名,证书用ip

纠正一点,网上说的cas证书生成只能用域名是错误的。也是可以用ip的,亲测有效。

1.在windows下的证书生成(域名)

注意:CN=域名,我们采用passport.sso.com

keytool -genkeypair -keyalg RSA -keysize 2048 -sigalg SHA1withRSA -validity 36500 -alias passport.sso.com -keystore d:/tomcat.keystore -dname "CN=passport.sso.com,OU=kawhi,O=carl,L=GuangZhou,ST=GuangDong,C=CN"

输入上述命令,下面密码我们输入changeit,然后一直回车,就在d盘生成了tomcat.keystore文件;

在cmd下输入如下命令,密码为上面输入的changeit:keytool -exportcert -alias passport.sso.com -keystore d:/tomcat.keystore -file d:/tomcat.cer -rfc

输入密码为 changeit并同意导入:keytool -import -alias passport.sso.com -keystore %JAVA_HOME%\jre\lib\security\cacerts -file d:/tomcat.cer -trustcacerts

2.在linxu下的证书生成(域名)

其实和在windows上的一样,只需要改一下地址就可以了。进入你服

上海宝贤技术有限公司SSO单点登录附demo , 经我自己测试,无BUG.完全可以用大型项目中。使用非常方便。 什么是SS0(Single sign-on)? Single sign-on (SSO) 单点登录,多个系统如果只在其中的一个系统登录过,再访问其它系统而不需要登录。 如何配置? Client 引用 1. Itble.SSO.Client.dll 2. Itble.SSO.Framework.dll Web.config <configuration> <configSections> <!-- SSO Section --> <section name="Itble.SSO" type="Itble.SSO.Framework.Config.SSOConfigReader,Itble.SSO.Framework"/> </configSections> <Itble.SSO> <Setting Key="AppIdentity" Value="UUMPWebsite"/> <Setting Key="SSOServerUrl" Value="http://localhost:8098/SSO.aspx"/> <Setting Key="FilterPageTypes" Value=".asmx;.css"/> <Setting Key="FilterPagePaths" Value="Pages;"/> <Interface Interface="ISSOClientHandler" ImplClass="Itble.SSO.Client.SSOClientHandler" Assembly="Itble.SSO.Client"/> <Interface Interface="ISSOHandlerFactory" ImplClass="Itble.SSO.Framework.Factory.SSOHandlerFactory" Assembly="Itble.SSO.Framework"/> <Interface Interface="ISSOModelFactory" ImplClass="Itble.SSO.Framework.Factory.SSOModelFactory" Assembly="Itble.SSO.Framework"/> </Itble.SSO> <system.web> <httpModules> <!-- SSO Module --> <add name="SSOClientHttpModule" type="Itble.SSO.Client.SSOClientHttpModule,Itble.SSO.Client"/> </httpModules> </system.web> </configuration> Code: IUserIdentity user = SSOClient.UserIdentity; Server 引用 1. Itble.SSO.Server.dll 2. Itble.SSO.Framework.dll Web.config <configuration> <configSections> <section name="Itble.SSO" type="Itble.SSO.Framework.Config.SSOConfigReader,Itble.SSO.Framework"/> </configSections> <Itble.SSO> <Setting Key="DefaultClientUrl" Value="http://localhost:8099/Default.aspx"/> <Setting Key="VerifyUrl" Value="http://localhost:8097/Login.aspx"/> <Setting Key="SSODomain" Value=""/> <Interface Interface="ISSOServerHandler" ImplClass="Itble.SSO.Server.SSOServerHandler" Assembly="Itble.SSO.Server"/> <Interface Interface="ISSOHandlerFactory" ImplClass="Itble.SSO.Framework.Factory.SSOHandlerFactory" Assembly="Itble.SSO.Framework"/> <Interface Interface="ISSOModelFactory" ImplClass="Itble.SSO.Framework.Factory.SSOModelFactory" Assembly="Itble.SSO.Framework"/> </Itble.SSO> <system.web> <httpModules> <add name="SSOServerHttpModule" type="Itble.SSO.Server.SSOServerHttpModule,Itble.SSO.Server"/> </httpModules> </system.web> Verify: 引用 1. Itble.SSO.Framework.dll Web.config <configuration> <configSections> <section name="Itble.SSO" type="Itble.SSO.Framework.Config.SSOConfigReader,Itble.SSO.Framework"/> </configSections> <Itble.SSO> <Setting Key="SSOServerUrl" Value="http://ssoserver.bbshell.com/SSO.aspx"/> <Interface Interface="ISSOHandlerFactory" ImplClass="Itble.SSO.Framework.Factory.SSOHandlerFactory" Assembly="Itble.SSO.Framework"/> <Interface Interface="ISSOModelFactory" ImplClass="Itble.SSO.Framework.Factory.SSOModelFactory" Assembly="Itble.SSO.Framework"/> </Itble.SSO> </configuration> Code: string account = txtAccount.Text.Trim(); string pwd = txtPwd.Text.Trim(); //todo:进行验证 //生成验证端请求对象 IVerifyRequest request = SSOContext.SSOModelFactory.CreateIVerifyRequestInstance(); request.UserIdentity.Identity = account; request.UserIdentity.IsRemember = IsRememberCheckBox.Checked; if (Request["returnUrl"] != null) { request.ReturnUrl = Request["returnUrl"]; } //将认证信息发送到服务端 IVerifyRequestHandler handler = SSOContext.SSOHandlerFactory.CreateIVerifyRequestHandlerInstance(); handler.PostLoginRequest(Context, request);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

那个id是什么东西

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值