【问题标题】:Single Sign Out using CAS in asp.net does not log out the user在 asp.net 中使用 CAS 单点注销不会注销用户
【发布时间】:2014-03-06 20:21:50
【问题描述】:

使用单点登录在 .Net 中安装应用程序。我们已经实施了 CAS。单点登录有效,但单点注销无效。

在 web.config 中 CAS 的配置如下:

<section name="casClientConfig" type="DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient"/>

<casClientConfig 
   casServerLoginUrl="http://aus-vc-bdpu-tl1.argous.com:8100/cas/login"
   casServerUrlPrefix=" http://au-vc-bdpu-tl1.argous.com:8100/cas" 
   serverName="http://localhost:53124/"
   cookiesRequiredUrl="~/CookiesRequired.aspx"
   redirectAfterValidation="true" gateway="false" renew="false" singleSignOut="true"  
   ticketTimeTolerance="50000000" 
   ticketValidatorName="Saml11" proxyTicketManager="CacheProxyTicketManager" 
   serviceTicketManager="CacheServiceTicketManager"
   gatewayStatusCookieName="CasGatewayStatus"/>

我添加了以下代码来清除注销功能的 cookie:

ClearAuthCookie();
string redirectPage = System.Configuration.ConfigurationSettings.AppSettings["CASurl"];
Response.Redirect(redirectPage, true);
public static void ClearAuthCookie()
{
    HttpContext current = HttpContext.Current;
    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName); 
    cookie.Expires = DateTime.Now.AddMonths(-1); 
    cookie.Domain = FormsAuthentication.CookieDomain;
    cookie.Path = FormsAuthentication.FormsCookiePath;
    current.Response.Cookies.Add(cookie);
}

我有两个问题:

(1) 注销时页面被重定向到所需页面,但如果我通过后退按钮返回应用程序主页并单击各种链接,页面将导航到链接而不是要求用户登录。因此注销不成功。

(2) 当用户在使用单点登录的另一个应用程序时,如果他从另一个应用程序注销,用户仍然可以访问我们的网站的父应用程序。因此单点注销不起作用

请您建议我在这里缺少什么以使其起作用。

【问题讨论】:

    标签: asp.net cas


    【解决方案1】:

    您现在可能已经想通了 - 但您必须使用的命令是:

    CasAuthentication.SingleSignOut(); 
    

    这会创建一个重定向到 CAS 服务器以进行服务器注销并删除本地身份验证 cookie

    See also this SO answer

    【讨论】:

    • 您能否在答案中添加此内容?
    猜你喜欢
    • 2015-03-19
    • 2013-07-24
    • 1970-01-01
    • 2011-09-01
    • 2011-07-16
    • 2015-05-07
    • 2012-08-09
    • 2020-07-08
    • 2017-07-06
    相关资源
    最近更新 更多