zoukankan      html  css  js  c++  java
  • CAS单点登录入门

    一、单点登录简介

      SOO是现在企业比较流行的业务整合解决方案之一,定义解决登录,可以应用在不同系统中,用户只需要登录一次,就可以访问所有相互信任的应用系统(模块开发、同家公司不同产品等等),例如百度,旗下的子系统。

    架构图如下

    二、环境搭建(准备需要用的cas-server包并配置)

       1.从CAS官网下载:上cas的官网下载cas server 官网地址:https://github.com/Jasig/cas/releases

      2.准备一份新的tomcat

      3.解压出cas-server包在”cas-server-4.0.0modules下的”cas-server-webapp-4.0.0.war复制一份到新的tomcat中运行。

      

      tomcat启动,运行效果如下。

      

      浏览器浏览效果如下:默认的账号:casuser    密码:Mellon    此默认配置可以在“apache-tomcat-7.0.93webappscasWEB-INFdeployerConfigContext.xml” 中修改

      

        4.配置cas 去除Https认证

        1.在apache-tomcat-7.0.93webappscasWEB-INFdeployerConfigContext.xml  p:requireSecure="false"配置这个属性 

    <!-- Required for proxy ticket mechanism. -->
        <bean id="proxyAuthenticationHandler"
              class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
              p:httpClient-ref="httpClient" p:requireSecure="false" />

          2.在apache-tomcat-7.0.93webappscasWEB-INFspring-configuration icketGrantingTicketCookieGenerator.xml中配置如下属性

    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
        <description>
            Defines the cookie that stores the TicketGrantingTicket.  You most likely should never modify these (especially the "secure" property).
            You can change the name if you want to make it harder for people to guess.
        </description>
        <bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
            p:cookieSecure="false"   ---->改成false
            p:cookieMaxAge="3600"  ---->设置ticket的cookie,以秒为单位
            p:cookieName="CASTGC"
            p:cookiePath="/cas" />
    </beans>

       3.apache-tomcat-7.0.93webappscasWEB-INFspring-configurationwarnCookieGenerator.xml 配置如下属性

    <bean id="warnCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
            p:cookieSecure="false"    --->改成false
            p:cookieMaxAge="3600"     --->设置ticket的cookie,以秒为单位
     p:cookieName="CASPRIVACY" p:cookiePath="/cas" />

       4.重启tomcat即可。

      

     三、Cas demo入门程序

      

    作者:独而不孤

    -------------------------------------------

    个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!

    如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!

    万水千山总是情,打赏一分行不行,所以如果你心情还比较高兴,也是可以扫码打赏博主,哈哈哈(っ•̀ω•́)っ✎⁾⁾!

    喂一下的我仓鼠谢谢
  • 相关阅读:
    C++实现数字媒体三维图像渲染
    C++实现数字媒体三维图像变换
    C++实现数字媒体二维图像变换
    C++实现glut绘制点、直线、多边形、圆
    语音识别之梅尔频谱倒数MFCC(Mel Frequency Cepstrum Coefficient)
    Java中的BigDecimal类精度问题
    spring 手册
    bootstrap 参考文档
    springBoot入门文章
    JNDI
  • 原文地址:https://www.cnblogs.com/lcaiqin/p/10436339.html
Copyright © 2011-2022 走看看