NutzCN Logo
问答 想问一下shiro的cas单点登录可以设置开关吗?求大牛指导指导
发布于 2446天前 作者 码农 2139 次浏览 复制 上一个帖子 下一个帖子
标签:

想问一下shiro的cas单点登录可以设置开关吗?求大牛指导指导

7 回复

怎样的开关????

@wendal 就是我需要单点这个功能的时候可以使用代码把它关闭掉,需要的时候再开启

继承CasFilter类,为所欲为

@wendal 但是就是单点服务器这边不是我搭建的,我是接入单点登录,我只能配置web.xml,

web.xml配了啥? 代码限制呗

@wendal
可以使用java代码控制web.xml中的配置的吗?

<!-- 单点登录配置 -->
      <listener>
    <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
    </listener>

    <filter>
        <filter-name>CAS Single Sign Out Filter</filter-name>
        <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>CAS Single Sign Out Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>CASFilter</filter-name>
        <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
        <init-param>
            <param-name>casServerLoginUrl</param-name>
            <param-value>http://172.16.61.39:8080/cas/login</param-value>
        </init-param>
        <init-param>
            <param-name>serverName</param-name>
            <param-value>http://127.0.0.1:8080</param-value>
        </init-param>
        
    </filter>
    <filter-mapping>
        <filter-name>CASFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>CAS Validation Filter</filter-name>
        <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
        <init-param>
            <param-name>casServerUrlPrefix</param-name>
            <param-value>http://172.16.61.39:8080/cas</param-value>
        </init-param>
        <init-param>
            <param-name>serverName</param-name>
            <param-value>http://127.0.0.1:8080</param-value>
        </init-param>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CAS Validation Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>CAS Assertion Thread Local Filter</filter-name>
        <filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>CAS Assertion Thread Local Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

继承一下SingleSignOutFilter,doFilter的时候判断一下呗,禁用的时候直接resp.sendError

添加回复
请先登陆
回到顶部